Please can anyone help me with the time conversion code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please can anyone help me with the time conversion code?

Day conversion to hours

26th Apr 2022, 11:16 AM
Aba Crentsil
8 Answers
+ 1
I think you know that a day has 24 hours. So if you have for example 3 days. You just take the number of days 24 times. So in this example 3*24.
26th Apr 2022, 11:49 AM
Stefanoo
Stefanoo - avatar
0
Thank you
26th Apr 2022, 4:23 PM
Aba Crentsil
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int emotion = scanner.nextInt(); switch(emotion){ case 1: System.out.print("You are happy!"); break; case 2: System.out.print("You are sad!"); break; case 3: System.out.print("You are angry!"); break; case 4: System.out.print("You are suprised!"); break; default: System.out.print("Unkwon emotion."); } } } Please any help with finding the bug at case 3?
26th Apr 2022, 4:23 PM
Aba Crentsil
0
You have a typo inside your default case. Unknown emotion.
26th Apr 2022, 4:52 PM
Stefanoo
Stefanoo - avatar
0
Thank you 😊....Any help with the board games codes.. tried but still gives me error
27th Apr 2022, 4:28 AM
Aba Crentsil
0
class Main { public static void main(String[] args) { //do not touch this code Monopoly monopoly = new Monopoly(); Chess chess = new Chess(); Battleships battleships = new Battleships(); monopoly.play(); chess.play(); battleships.play(); } } abstract class Game { abstract String getName(); abstract void play(); } class Monopoly extends Game { //give "Monopoly" name to game String getName() { return "Monopoly" ; } // play method should print "Buy all property." void play() { System.out.println("Buy all property."); } } class Chess extends Game { //give "Chess" name to game String getName() { return "Chess" ; } // play method should print "Kill the enemy king" void play() { System.out.println("Kill the enemy king."); } } class Battleships extends Game { //give "Battleships" name to game String getName() { return "B
27th Apr 2022, 4:29 AM
Aba Crentsil
0
By the way you can post a code with the plus sign surrounded with a circle. There you find all codes in the playground. Just set the filter on [My code bits] and pick the code you want to show us. You can also post your private codes.
27th Apr 2022, 2:07 PM
Stefanoo
Stefanoo - avatar
0
Pls I just need help with this one I have to get my certificate for submission before Friday
27th Apr 2022, 5:44 PM
Aba Crentsil