Results 1 to 3 of 3
  1. #1
    soudka is offline Member
    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Default All I need is a solution and only than guidance

    1.Add a new class to the project called CAR. add a member variable of type int called velocity.
    2.Add a method to the CAR class called accelerate (). The return value should be void and it should have no parameters. This method should increase the velocity by 10.
    3.Add a similar method called brake() that decreases the velocity be 20.
    4.Add a similar method stop() that sets the velocity to 0.
    5.Add a method called setVelocity() that has an int as a parameter and returns void. The value that is passed in to this method should become the new velocity of the car.
    6.Add a method called getVelocity() that has no parameters and returns the velocity.
    7.Compile the CAR class.
    8.Create new class called CarProgram.
    9.Within the main() method of CarProgram , declare a CAR reference called porsche. Assigne porsche to a new CAR.
    10.Set the velocity to be 55 using the set velocity() method.
    11.Use getVelocity() and the System.out.println() method to display the velocity to make sure it works.
    12.Invoke accelerate(), brake(), and stop() several times and display the velocity each time to ensure that the methods are working properly.
    13.Compile and run the CarProgram.

    I know it is lame, and i am lame, but all I want is to see how it's done. I can't even complete step 2. I am struggaling with english and sometimes it is very hard to interpret the what i am asked to do. Please help me with this.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: All I need is a solution and only than guidance

    This is a forum. Not a homework service. Recommended reading: How to ask questions the smart way

    I'm closing this thread. If you have a specific question about your own efforts, feel free to start another thread.

    Note that repeated homework dumps may result in a ban.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: All I need is a solution and only than guidance

    Quoted for record:

    Quote Originally Posted by soudka View Post
    1.Add a new class to the project called CAR. add a member variable of type int called velocity.
    2.Add a method to the CAR class called accelerate (). The return value should be void and it should have no parameters. This method should increase the velocity by 10.
    3.Add a similar method called brake() that decreases the velocity be 20.
    4.Add a similar method stop() that sets the velocity to 0.
    5.Add a method called setVelocity() that has an int as a parameter and returns void. The value that is passed in to this method should become the new velocity of the car.
    6.Add a method called getVelocity() that has no parameters and returns the velocity.
    7.Compile the CAR class.
    8.Create new class called CarProgram.
    9.Within the main() method of CarProgram , declare a CAR reference called porsche. Assigne porsche to a new CAR.
    10.Set the velocity to be 55 using the set velocity() method.
    11.Use getVelocity() and the System.out.println() method to display the velocity to make sure it works.
    12.Invoke accelerate(), brake(), and stop() several times and display the velocity each time to ensure that the methods are working properly.
    13.Compile and run the CarProgram.

    I know it is lame, and i am lame, but all I want is to see how it's done. I can't even complete step 2. I am struggaling with english and sometimes it is very hard to interpret the what i am asked to do. Please help me with this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Guidance
    By meenakshipuni in forum New To Java
    Replies: 3
    Last Post: 10-30-2011, 01:51 PM
  2. Some Guidance
    By bengregg in forum Java Applets
    Replies: 15
    Last Post: 01-11-2011, 11:04 AM
  3. Guidance for SCJP
    By sairam in forum New To Java
    Replies: 1
    Last Post: 06-30-2010, 10:21 AM
  4. Guidance needed
    By Curtiz in forum AWT / Swing
    Replies: 1
    Last Post: 03-23-2010, 06:41 PM
  5. Guidance
    By gizdev in forum New To Java
    Replies: 5
    Last Post: 09-07-2008, 08:14 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •