can you please create a java that will accepts some amount of money from the user and will count how many bills are there like thousands, hundreds, tens, and ones….
[code] import java.util.Scanner; public class AnthonyWhiteProg4 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); double speed; // User entered value double distance; // user entered value double stoppingDistance = speed * (2.25 + speed/21); // number
System.out.print(“Enter your speed (mph): “); speed.stdIn.nextDouble(); System.out.print(“Enter your tailgate distance: “); stoppingDistance.stdIn.nextDouble();
if(stoppingDistance==tailGatingDistance); { system.out.println(“Minor wreck”); } if(stoppingdistance > tailGatingDistance); { system.out.println(“No problem”); } else { system.out.println(“Major wreck”); } } // end main } // end class [/code]
nope the program has one error at line 34, error with the else without if else
there is no error because there is no line 34 LOL!
actually it is line no. 24,not 34.writer has miswritten it.
i think the line 20 should be “else if”. . .=P am i right???or wrong. . .pls reply. . .thanks. . .
the program is not working while compilation it shows error at line 34 (if else)
plz correct it
Create a program that allows the user to input 5 values then output the maximum value inputted.
Write a program that displays a histogram that shows the occurrences of each letter in a text area. Assume that the letters are not case- sensitive.
can you please create a java that will accepts some amount of money from the user and will count how many bills are there like thousands, hundreds, tens, and ones….
write program ti generate 5500 car registration numbers to used.
[code]
import java.util.Scanner;
public class AnthonyWhiteProg4
{
public static void main(String[] args)
{
Scanner stdIn = new Scanner(System.in);
double speed; // User entered value
double distance; // user entered value
double stoppingDistance = speed * (2.25 + speed/21); // number
System.out.print(“Enter your speed (mph): “);
speed.stdIn.nextDouble();
System.out.print(“Enter your tailgate distance: “);
stoppingDistance.stdIn.nextDouble();
if(stoppingDistance==tailGatingDistance);
{
system.out.println(“Minor wreck”);
}
if(stoppingdistance > tailGatingDistance);
{
system.out.println(“No problem”);
}
else
{
system.out.println(“Major wreck”);
}
} // end main
} // end class
[/code]
is the program above is running???
please do reply.,.
its running,,
actually the program has already pass your house;
dont put ; at the end of parameter
the above program has no eeors
good work !!!
i think it will not run because the one if statement there has no else ..
import java.util.*;
public class AnthonyWhiteProg4
{
public static void main(String[] args)
{
Scanner stdIn = new Scanner(System.in);
double speed; // User entered value
double tailGatingDistance; // user entered value
double stoppingDistance;
System.out.print(“Enter your speed (mph): “);
speed = stdIn.nextDouble();
System.out.print(“Enter your tailgate distance: “);
tailGatingDistance = stdIn.nextDouble();
stoppingDistance = speed * (2.25 + speed/21); // number
if(stoppingDistance==tailGatingDistance)
{
System.out.println(“Minor wreck”);
}
else if(stoppingDistance < tailGatingDistance)
{
System.out.println(“No problem”);
}
else
{
System.out.println(“Major wreck”);
}
} // end main
} // end class
This was my end results after going through all the errors. I am new to programming so any criticism is welcomed, but please be gentle. 🙂