Whats wrong with this please help me im about to lose my mind.
Updated it.Code:import java.util.Scanner; //Scanner Object. /** * @(#)DistanceTraveled.java * * DistanceTraveled application * * @author * @version 1.00 2013/3/15 */ public class DistanceTraveled { public static void main(String[] args) { //Declare Variables int speed; int hours; int distance; //Create a Scanner Object Scanner keyboard = new Scanner(System.in); //Accept user input System.out.print("What is the speed of the vehicle?"); speed = keyboard.nextInt(); System.out.print("What is the hours it has traveled?"); hours = keyboard.nextInt(); distance = speed * hours; //Display the table System.out.println("Hours Distance Traveled"); System.out.println("-----------------------"); for (int houR = 1; Distance <= distance; Hour++ ); { System.out.println(houR + "\t\t" + houR * distance); } } }
Results 1 to 8 of 8
Thread: Help?
- 16 Mar. 2013 12:42am #1
- Age
- 97
- Join Date
- Nov. 2009
- Location
- In the computer
- Posts
- 11,186
- Reputation
- 1029
- LCash
- 0.25
- Awards
Help?
Last edited by Taz; 16 Mar. 2013 at 12:52am.
- 16 Mar. 2013 01:15am #2
Moderator Bachelor of Science in Virginity
- Age
- 31
- Join Date
- Nov. 2009
- Location
- Toronto
- Posts
- 5,421
- Reputation
- 546
- LCash (Rank 3)
- 1.96
Code:import java.util.Scanner; //Scanner Object. /** * @(#)DistanceTraveled.java * * DistanceTraveled application * * @author * @version 1.00 2013/3/15 */ public class DistanceTraveled { public static void main(String[] args) { //Declare Variables int speed; int hours; int Hour; double Distance = 0; //Create a Scanner Object Scanner kayboard = new Scanner(System.in); //Accept user input System.out.print("What is the speed of the vehicle?"); speed = kayboard.nextInt(); System.out.print("What is the hours it has traveled?"); hours = kayboard.nextInt(); Distance = speed * hours; //Display the table System.out.println("Hour Distance Traveled"); System.out.println("-----------------------"); for (Hour = 0; Hour<hours; Hour++){ System.out.println(Hour+1 + "\t\t" + Distance / (hours - Hour)); } } }
- 16 Mar. 2013 01:31am #3
- Age
- 97
- Join Date
- Nov. 2009
- Location
- In the computer
- Posts
- 11,186
- Reputation
- 1029
- LCash
- 0.39
- Awards
- 19 Mar. 2013 07:38pm #4
- Age
- 97
- Join Date
- Nov. 2009
- Location
- In the computer
- Posts
- 11,186
- Reputation
- 1029
- LCash
- 1.20
- Awards
I have another problem which is making me explode...
Its so simple but so hard.
Code:Write nested loops to draw this pattern: ## #..# #...# #....# #.....# #.......#
- 20 Mar. 2013 01:38am #5
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 0.82
- 20 Mar. 2013 08:10pm #6Code:
for(int x = 0; x < 8; x++) { if(x != 1 || x != 6) { print("#") for(int y = 0; y < x; y++) { print("."); } print("#\n"); } }
- 20 Mar. 2013 08:29pm #7
Moderator Bachelor of Science in Virginity
- Age
- 31
- Join Date
- Nov. 2009
- Location
- Toronto
- Posts
- 5,421
- Reputation
- 546
- LCash (Rank 3)
- 1.96
- 20 Mar. 2013 08:35pm #8