0
MĂșltiple Test Checks
For challenges with multiple test checks, how can I complete all of them at once? If I submit for the first one, the others stay red. I go change the code for the 2nd one and the first one goes red.
5 Answers
+ 1
Like i said you have to use input. Therefore a scanner object is already created for you. Usage is explained in lesson 1.5: Getting user input
https://www.sololearn.com/learning/2220/
+ 2
Make a generic code that passes all
the test cases.
You have to make sure that your code is perfect for any input it takes.
You can give details of the module your are solving with your failed attempt so that the community can help you If you are stuck somewhere.
0
Each test also provides a distinct input. Your code has to generate the correct output from the input following the rules in the challenge description. So your code has to work for any valid input.
What you should do is defined by the _description_, not by the test cases
0
So for the challenge I'm working on now in Java, it is asking for days to seconds for 2 days on one of the test checks, and then 53 days on the next test check.
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = 53;
int sum1 = days * 24;
int sum2 = sum1 * 60;
int sum3 = sum2 * 60;
System.out.println(sum3);
}
}
that's what I have so far but like I said, it doesn't check off both and I'm not sure how to get it to. do I need to do a completely new input?
0
Christopher Blackburn
Use your logic and apply all conditions.