Question: need help with a java program. this lab is over classes and objects. i have added the scope of work for this lab and is

need help with a java program. this lab is over classes and objects. i have added the scope of work for this lab and is in numerical order of steps we need to follow.

1. Define a Car class with three member field, String brand, String model, int year.

2. Define a constructor that takes arguments. For example, public Car(String brand, String model, int year);

3. In the constructor, use three assignment statements to assign three arguments values into three member fields as an initialization.

4. After the constructor, define three member methods (getBrand(), getModel(), getYear()) that return corresponding member field. For example, getBrand() function returns the value of variable Brand.

5. Note that Class Car doesnt have main method.

6. Define another class names as Lab6 in a different file. For example, public class Lab6 { }

7. In the main method of the class Lab6, declare a Car instance variable, instantiate, and initialize three member field using the constructor. For example, Car myCar = new Car(Toyota, Camry, 2017);

8. To verify the initialization, call all three member methods of class Car in the main method of class Lab6, and display the three values using the object and dot operator. For example, System.out.println(Brand: + myCar.getBrand);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!