Question: public class Car { / / Fields private String make; private String model; private String color; private double baseCost; / / Accessors ( GET )

public class Car {
// Fields
private String make;
private String model;
private String color;
private double baseCost;
// Accessors (GET) Methods
public String getMake(){
return make;
}
public String getModel(){
return model;
}
public String getColor(){
return color;
}
public double getBaseCost(){
return baseCost;
}
// Mutators (SET) Methods
public void setMake(String make){
this.make = make;
}
public void setModel(String model){
this.model = model;
}
public void setColor(String color){
this.color = color;
}
public void setBaseCost(double baseCost){
this.baseCost = baseCost;
}
// Special Purpose Method
public double calculateFinalCost(){
return baseCost *1.05; //5% tax
}
// Constructor
public Car(String make, String model, String color, double baseCost){
this.make = make;
this.model = model;
this.color = color;
this.baseCost = baseCost;
}
}

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!