Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Java... Modify or write a similar class to Ch7-PC2 so it holds the data of

ID: 3812627 • Letter: U

Question

Using Java...

Modify or write a similar class to Ch7-PC2 so it holds the data of a vehicle. The Vehicle class should have two constructors (see Ch6-PC4), appropriate get and set methods and the following fields:

make: string, holds vehicle make, i.e. Ferrari

model: string, holds vehicle model, i.e. F12Berlinetta

style: string, holds vehicle style, i.e. sedan, minivan, sports, truck

vinNumber: integer, holds the number of rooms in the vehicle

price: double, holds the vehicle price

sold: boolean, hold true for sold false for not sold

month: int, holds the number of the month the vehicle sold, 0 if not sold.

agentID: String, holds the agentID assigned to the vehicle.

Explanation / Answer

Vehicle.java


public class Vehicle {
   private String make, model, style, agentID;
   private int vinNumber, month;
   private double price;
   private boolean sold;
   public Vehicle() {
      
   }
   public Vehicle(String make, String model, String style,int vinNumber, double price, boolean sold, int month, String agentId){
       this.model = model;
       this.make = make;
       this.style = style;
       this.vinNumber = vinNumber;
       this.price = price;
       this.sold = sold;
       this.month = month;
       this.agentID = agentId;
   }
   public String getMake() {
       return make;
   }
   public void setMake(String make) {
       this.make = make;
   }
   public String getModel() {
       return model;
   }
   public void setModel(String model) {
       this.model = model;
   }
   public String getStyle() {
       return style;
   }
   public void setStyle(String style) {
       this.style = style;
   }
   public String getAgentID() {
       return agentID;
   }
   public void setAgentID(String agentID) {
       this.agentID = agentID;
   }
   public int getVinNumber() {
       return vinNumber;
   }
   public void setVinNumber(int vinNumber) {
       this.vinNumber = vinNumber;
   }
   public int getMonth() {
       return month;
   }
   public void setMonth(int month) {
       this.month = month;
   }
   public double getPrice() {
       return price;
   }
   public void setPrice(double price) {
       this.price = price;
   }
   public boolean isSold() {
       return sold;
   }
   public void setSold(boolean sold) {
       this.sold = sold;
   }
  
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote