Jave homework help

Discussion in 'OT Technology' started by Garage Battle, Feb 15, 2006.

  1. Garage Battle

    Garage Battle "She sprayed the playa@#she sprayed the pimp#! OT Supporter

    Joined:
    Jan 27, 2002
    Messages:
    16,089
    Likes Received:
    71
    Location:
    in a secret garage down the alley
    Code:
    import java.awt.*;
    
    public class LuxuryCar {
        public LuxuryCar() {
        }
    
        public LuxuryCar(String size, Color color, int year, String make) {
            this.year = year;
            this.size = size;
            this.make = make;
            this.color = color;
    
        }
    
        public int year = 2002;
        String make = "BMW";
        String size = "Mid-size";
        public Color color = Color.blue;
    
    } //end class customer
    there are the 3 steps im having trouble with:

    11. Write a main method within the LuxuryCar class and instantiate an object of the LuxuryCar class within it, be sure to use the overloaded constructor, passing in new values for each parameter expected. HINT: Use new values OTHER than the values that you initialized the variables with, please be creative.

    12. Use the LuxuryCar object to invoke each of the maintenance events declared within the Car class. HINT: For example, if your LuxuryCar object was called lc, then this is the syntax for invoking the changeOil method: lc.changeOil ();

    13. Finally, create another method within the LuxuryCar class called descCar that takes no parameters and returns nothing.

    due by 12 tonight, TIA!
     
  2. samm

    samm Next in Line

    Joined:
    Dec 22, 2000
    Messages:
    2,630
    Likes Received:
    0
    Location:
    San Jose, CA
    Why are you stuck on #11? It is very straightforward:

    1. write your main function
    2. instantiate a LuxuryCar object using the constructor you already wrote
     
  3. rpark

    rpark New Member

    Joined:
    Apr 9, 2005
    Messages:
    1,082
    Likes Received:
    0
    Location:
    Isla Vista, California
    I would say LuxuryCar is wrong too.
     

Share This Page