Practice tests not working | SoloLearn: Learn to code for FREE!

+4

Practice tests not working

I do the practice tests for Java course but I will get test #1 correct but it says try again because they want me to do the other tests how do I do those?

4/21/2021 6:50:19 AM

Mohammad Totah

23 Answers

New Answer

+8

Steps to solve any coding challenge: 1. Read the whole description completely. 2. Identify the inputs and outputs. 3. Think how to process the input to get the expected output. 4. Write pseudocode in paper. 5. Convert it to code. 6. Test the program whether it gives correct output or not. 7. If not, repeat steps from 2 to 6 again. If yes, bingo!

+5

What is prob? Use int total=days*seconds*minutes*hours;

+4

Hi! For better help to you, Please, show us your code attempt!

+2

If you're facing problem with network connection or any problem with sololearn server may give same thing that " Try Again " If you're facing problem with test cases then follow below steps Step 1. Read description thoroughly to get clear idea about what the problem is and what the problem demanding Step 2. Think about the optimal solution Step 3. Write a pseudo code for the same Step 4. Check the code by yourself Step 5. Here , choose the language you're comfortable can able to convert pseudo code to particular programming language efficiently. Step 6. Check the code by yourself Step 7. Run Step 8 . If successful good if not repeat steps 1-8 I hope you got my point, if not feel free to raise your voice !!

+1

Hi! you should not hard-code the number of days. you did this in the "prob" variable. use the "days" variable, which is already defined and located above, for the extensions. your task is to write a universal program that will give an answer regardless of any number of days

+1

this code that you wrote to us was made by you personally?

+1

I got the assignment. and I've already solved it. I'm trying to explain to you what your mistake is, but I see that you didn't understand even the most basic thing. Therefore, I have doubts that the decision was written by you personally. where did you get the code?

+1

can you explain in a nutshell what your program does? at least write what purpose and what each variable is responsible for?

+1

then explain the value of the variable prob

+1

use the days variable instead of your prob variable. look up, and you'll see it there in the code. remove your prob variable from the program. imagine that you were given an order to write a program for calculating the number of seconds in days, but the number of days is initially unknown to you. the customer himself would like to enter any desired number of days and get the result. how would you do that? your program is imperfect. it shows the seconds of only two days

+1

ask questions if something is not clear

+1

Read the task statement again and again , you probably miss any of the task. In one of the problems I missed to handle numbers they didn't use numbers in sample input and output but mentioned in the task statement.

0

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); //your code goes here int prob = 2; int hours = 24; int minutes = 60; int seconds = 60; int total = prob * hours * minutes * seconds; System.out.println(total); } } I got this correct! But there is Test#2 that is incorrect but how do i get to Test2. Im doing Module 10

0

Could you show me an example

0

Look at module 10 for Java thats what im working on.

0

I did the code for it

0

I coudnt use day so i needed something else

0

I did but it say “variable days is already defined in main String. I cant use it

0

you probably re-declare this variable in your code. this variable has already been declared. just use it. the idea is that you should add, supplement the program already started by someone. here someone before you sat down and wrote the first lines of code, then got up and left, then you appeared and you just need to finish what was started. the "days" variable has already been announced and is ready for use. where do you think it should be applied?

0

you probably do not understand where the variable "days" came from and what value it takes. relatively speaking, this variable takes" from someone who enters this value " the number of days. you don't know this value, but you need to make a calculation