Results 1 to 3 of 3
Thread: Java Error Class Help !!
- 05-10-2010, 01:33 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 5
- Rep Power
- 0
Java Error Class Help !!
Hello friends,
We were given this code and told to fix the error can you help me i fixed as many i could now i am left with this one and i tried to fix but cant get it -
And the error i get is -PHP Code:import java.util.Scanner; public class findTheError { public static void main (String[] args) { int yearModel1, yearModel2; //year model for car 1&2g int count; String information1, information2; //Car information for car1 and car2 Scanner keyboard = new Scanner(System.in); //Create a Car object. Car car1 = new Car(); Car car2 = new Car(); //Get an information of car1 from user System.out.println(" Enter your car's name"); information1 = keyboard.nextLine(); System.out.println(" Which year model is your car?"); yearModel1 = keyboard.nextInt(); for(count=1; count<=8; count++) { car1.accelerate(); } System.out.println("The speed is:" + car1.getspeed()); for(count=1; count<=8; count++) { car1.brake(); } System.out.println("After giving brake, the speed is:" + car1.getspeed()); //Get information of car2 from user keyboard.nextLine(); System.out.println(" Enter your car's name"); information2 = keyboard.nextLine(); System.out.println(" Which year model is your car?"); yearModel2 = keyboard.nextInt(); for(count=1; count<=6; count++) { car2.accelerate(); } System.out.println("The speed of the car is: "+ car2.getspeed()); for(count=1; count<=6; count++) { car2.brake(); } System.out.println("After brake, the speed of the car is: "+ car2.getspeed()); } }
Thanks a lot and plzzzz helpPHP Code:C:\Users\Desktop\findTheError.java:17: cannot find symbol symbol : class Car location: class findTheError Car car1 = new Car(); ^ C:\Users\Desktop\findTheError.java:17: cannot find symbol symbol : class Car location: class findTheError Car car1 = new Car(); ^ C:\Users\Desktop\findTheError.java:19: cannot find symbol symbol : class Car location: class findTheError Car car2 = new Car(); ^ C:\Users\Desktop\findTheError.java:19: cannot find symbol symbol : class Car location: class findTheError Car car2 = new Car(); ^ 4 errors Tool completed with exit code 1
-
Do you have a Car class? If not, you may need to create one that has all the methods that this class is trying to call.
- 05-10-2010, 02:42 AM #3
Member
- Join Date
- Oct 2009
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
E:\IT 215 Java Programming\public class Inventory.java:39: class, interface, or enum
By tlouvierre in forum New To JavaReplies: 14Last Post: 05-28-2009, 05:44 AM -
Class Expected error
By Radman23 in forum New To JavaReplies: 11Last Post: 01-14-2009, 04:12 AM -
No Class Def Found Error:
By wrap23 in forum New To JavaReplies: 9Last Post: 10-02-2008, 04:07 AM -
Cast Error Caught (change) Class is really: java.lang.String
By barney in forum Advanced JavaReplies: 1Last Post: 08-02-2007, 04:07 PM -
Error in class
By ai_2007 in forum Advanced JavaReplies: 1Last Post: 07-09-2007, 04:06 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks