Practice 6.3 issue | SoloLearn: Learn to code for FREE!

+1

Practice 6.3 issue

So I did this practice and got all test answers correct except for Test 2, but if I change anything to fix test 2 then all the other tests will be incorrect, what’s going on?

4/22/2021 6:49:04 AM

Mohammad Totah

38 Answers

New Answer

+4

Hi! logically, do you understand why the second test does not pass? do you analyze what the testing program expects from you and what your program outputs?

+2

Post the question as well as the answer too

+1

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int math = scanner.nextInt(); int history = scanner.nextInt(); int geometry = scanner.nextInt(); //your code goes here Int minutes = 60; Int hours = 60; System.out.println((math + history + geometry) / minutes); System.out.println(math + history + geometry - hours); } }

+1

Post your question(problem)too

+1

Students are given homework in math, history, and geometry. Write a program that takes the time spent on each subject as input, and calculates and outputs the total number of hours and minutes spent on each subject, each on a new line accordingly.

+1

Whoever has done Java 6.3 module subject homework, please let me know if there is an issue with Test Case #2, because it should work

+1

yes, that's right, this is a verification requirement. and what does your code output?

0

I do understand what it expects from me, but i dont understand what why test2 isnt working

0

so, what does test #2 expect from you? have you analyzed the output results of your program? what is the result? write it here. and what answer is waiting for test #2? also write it here, in the message

0

First you get to know in which unit the input is given. If hours print hours and then convert it into minutes by multiplying 60 with hours

0

Input: 40 52 36 Requested output: 2 8

0

My code: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int math = scanner.nextInt(); int history = scanner.nextInt(); int geometry = scanner.nextInt(); int minutes = 60; int hours = 60; System.out.println((math + history + geometry) / minutes); System.out.println((math + history + geometry) - hours); } }

0

you wrote the task text. go to the task itself, run your code, and see the result. test #2 can be hidden, click on the green check mark. a window opens with the results. what do you see? print them here

0

My code outputs 2 68

0

2 8 and 2 68 what's wrong here? can you explain?

0

The output has to end with 2 and 8 But im getting 2 and 68 meaning another 60 has to be removed fromthe equation. If i do that all test cases will be incorrect except test2

0

excellent! you understand that! the extra 60 should be removed!

0

are you familiar with the branch operator?

0

Add the inputs and divide it by 60

0

To get hours