+ 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?
22 Answers
+ 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!
+ 3
Hi! For better help to you, Please, show us your code attempt!
+ 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
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
0
did you manage to solve it? as a beginner, you are making great progress. have you ever done any programming before?