Java coding program 1

User Generated

Wbqn

Programming

Description

Problem Description

You are to develop and test the Java classes needed to maintain a collection of vehicles of various type rented by a given vehicle rental agency.

Problem Scenario

A vehicle rental agency offers various model cars, SUVs and trucks for rent. Vehicles are identified by a unique VIN (Vehicle Identification Number). The set of features maintained for cars, SUVs and trucks are different. Cars are specified as a specific make and model, a miles per gallon rating, and seating capacity. SUVs are specified as a particular make and model, a miles per gallon rating, seating capacity, and cargo capacity. Trucks are specified as a particular length (in feet), miles per gallon rating, and load capacity.

The list of vehicles that you MUST USE, including the vehicle identification numbers (VINs) provided for this assignment, is given below.

//please see the attached pictures for the rest of the instructions.

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Hello, I attached the java program in a .zip and the codes in another .zip. You will find all the classes right there.

package Agency_classes;
//There is an inheritance from Vehicle, thus the child class has the attributes make,model mpg and
vin and the abstract method toString() .
public class Car extends Vehicle{
private int sc;
public Car(String make,String model,int mpg,int sc,String vin) {
super(make,model,mpg,vin);
this.sc=sc;
}
//the methods to find and show each attribute of the child class
public int getsc(){
return this.sc;
}
public void setsc(int sc){
this.sc=sc;
}

public String toString() {
String str;
str=this.getmake()+ " "+this.getmodel()+"(CAR)"+ " MPG:"+this.getmpg()+ " Seating:"+"
Storage:"+this.sc+ " VIN:"+this.getVIN();
return str;
}

}


package Agency_classes;
There is an inheritance from Vehicle, thus the child class has the attributes make, model mpg and
vin and the abstract method toString() .
public class Suv extends Vehicle{
private int sc;
private int cc;
public Suv(String make,String model,int mpg,int sc,int...


Anonymous
Awesome! Made my life easier.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags