+ 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?

21st Apr 2021, 6:50 AM
Mohammad Totah
Mohammad Totah - avatar
24 odpowiedzi
+ 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!
21st Apr 2021, 6:56 AM
Genuine Stalwart
Genuine Stalwart - avatar
+ 3
Hi! For better help to you, Please, show us your code attempt!
21st Apr 2021, 6:55 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 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
21st Apr 2021, 8:51 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
this code that you wrote to us was made by you personally?
21st Apr 2021, 9:04 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 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?
21st Apr 2021, 9:08 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
can you explain in a nutshell what your program does? at least write what purpose and what each variable is responsible for?
21st Apr 2021, 9:10 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
then explain the value of the variable prob
21st Apr 2021, 9:11 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 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
21st Apr 2021, 9:21 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
ask questions if something is not clear
21st Apr 2021, 2:10 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 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.
22nd Apr 2021, 5:59 AM
Manikandan
Manikandan - avatar
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
21st Apr 2021, 8:44 AM
Mohammad Totah
Mohammad Totah - avatar
0
Could you show me an example
21st Apr 2021, 9:00 AM
Mohammad Totah
Mohammad Totah - avatar
0
Look at module 10 for Java thats what im working on.
21st Apr 2021, 9:06 AM
Mohammad Totah
Mohammad Totah - avatar
0
I did the code for it
21st Apr 2021, 9:10 AM
Mohammad Totah
Mohammad Totah - avatar
0
I coudnt use day so i needed something else
21st Apr 2021, 9:14 AM
Mohammad Totah
Mohammad Totah - avatar
0
I did but it say “variable days is already defined in main String. I cant use it
21st Apr 2021, 9:32 AM
Mohammad Totah
Mohammad Totah - avatar
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?
21st Apr 2021, 12:43 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
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
21st Apr 2021, 12:50 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Thank you kindly for your thorough explanation and help. I truly appreciate it. You have to be patient with me i just started to learn coding a few days ago
21st Apr 2021, 1:55 PM
Mohammad Totah
Mohammad Totah - avatar
0
did you manage to solve it? as a beginner, you are making great progress. have you ever done any programming before?
21st Apr 2021, 2:00 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar