java - Error: Could not find or load main class vehicle.Vehicle -


i still @ helloworld when comes lack of java skills. cannot understand save life. working on writing override method? , starting out code provided school before start trying complete rest , getting errors cannot begin think of how correct. @ appreciated. want error go away can create new ones :) here code:

public class vehicle public static void main (string [] args)} { private boolean moving; // whether or not vehicle private double speed;  private char bearing;  ('n','e','s', or 'w') public vehicle(){ // vehicle class no-arg constructor     moving = false; // assume not moving     speed = 0.0; // not moving     bearing = 'n'; // assume 'n'orth     system.out.println("created vehicle (no-arg)");  } public vehicle (double initialspeed) // vehicle 1-arg constructor     bearing = 'w';     speed = initialspeed;     if (speed > 0.0)     {         moving = true;     }     system.out.println("created vehicle (1-arg)");  public vehicle (double initialspeed, char initialbearing) // vehicle 2-arg constructor     bearing = initialbearing;     speed = initialspeed;     if (speed > 0.0){         moving = true;     }     system.out.println("created vehicle (2-arg)"); public void start(double initialspeed, char initialbearing){     moving = true;     if (initialspeed >= 5.0 && initialspeed <= 20.0){         speed = initialspeed; // valid expected range     } else if (initialspeed >= 0.0 && initialspeed < 5.0){         speed = 5.0; // minimum     } else if (initialspeed < 0.0){         speed = 0.0; // assume no movement         moving = false;     } else if (initialspeed > 20.0){         speed = 20.0; // maximum allowed     }     switch(initialbearing){     case 'n':         bearing = initialbearing;         break;     case 'e':         bearing = initialbearing;         break;     case 's':         bearing = initialbearing;         break;     case 'w':         bearing = initialbearing;     default: system.out.println("invalid bearing " +       initialbearing +      " set n"); // additional user notification      bearing = 'n'; } public double getspeed() { // , return current speed in mph     return speed; } public void setspeed(double newspeed){ // set new speed in mph      speed = newspeed; }     /**      *      * @return      */ public char getbearing(){     return bearing; } public void speedup(double mphsteps, int numsteps){     int counter = 0;     while (counter < numsteps)     speed += mphsteps;     system.out.println("counter= " + counter + ", " +      this.tostring());     counter++; } public string tostring(){     return "from tostring(): speed= " + getspeed() +     " mph , bearing= " + getbearing(); }  } public class car extends vehicle{     private string color;     private int doors;      private double hp;      public car(string carcolor, int numdoors,      double horsepower, double     startingspeed)  { super(startingspeed); color = carcolor; doors = numdoors;  hp = horsepower;  system.out.println("created car");  } public string getcolor() { return color; } public int getdoors() { return doors; } public double gethp() { return hp; } public string tostring() { return "from car tostring(): color= " + getcolor() + " doors= " + getdoors() +  " hp= " + gethp() + " speed= " + getspeed() + " mph , bearing= " + getbearing();}  } public class testcar2 { public static void main(string[] args) {  car mycar2 = new car("blue", 4, 300., 10.0);  system.out.println(mycar2.tostring()); mycar2.speedup(5.0, 2);  } } 

please please , thank helping!

public class vehicle  public static void main (string [] args)} // totally wrong      // not compile @ least  { 

actually parenthesis({}) using totally wrong. following structure should follow you. guessing not using ide coding. suggest use ide code.

public class myclass{   public static void main(string[] args){    // main method  }  // other method  } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -