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

Please help. Work is due this friday Problem Description You are to develop a Ja

ID: 3836054 • Letter: P

Question

Please help. Work is due this friday

Problem Description You are to develop a Java program capable of maintaining vehicle rental reservations for a vehicle rental agency using an object-oriented design Problem scenario The vehicle rental agency has both private and corporate customers. The agency offers cars, SUVs and moving trucks for rent Vehicles may be rented for a period of days, weeks, or months. Monthly rentals are cheaper (on a daily basis) than weekly rentals, and weekly rentals are cheaper than daily rentals. Also, cars, SUVs and trucks each have models of cars, SUVs or trucks.) In addition, corporate customers receive a 15% discount on the total cost of rentals. There is optional daily insurance available, which is the same cost for cars and SUVs, and more expensive for moving trucks Private and corporate customers of the rental agency may do the following: (1) view the current rental rates for a given vehicle type (car, SUV or truck), (2) view a list of available (ie., unreserved) vehicles of a given type, (3) display an estimated cost of a particular rental (for a given vehicle type, rental period, expected number of miles driven, and insurance option), (4) reserve a vehicle, (5) display their current reservations, and (6) cancel a reservation, (private customers allowed only one rental at a time, corporate customers will generally have multiple reservations at the same time) Managers of the vehicle rental agency may do the following: (1) display the current rental rates for all vehicle types, (2) display all vehicles owned by the rental agency (i.e., both reserved and unreserved), (3) display all current reservations, (4) add a new corporate account, and (5) display all corporate accounts, including a list of currently reserved vehicles for each Vehicles are identified based on a unique VIN Vehicle Identification Number). The set of features stored for cars, SUVs and trucks are different. Cars are specified as a particular make and model, a miles per gallon rating, and number of seats. SUVs are specified as a particular make and model, a miles per gallon rating, and number of bench seats Trucks are specified by a particular length (in feet) miles per gallon rating, and number of rooms storage capacity The list of vehicles that you must use for this assignment are given below

Explanation / Answer

1. AccountIterator.java

-----------------------------------

package vehiclerentalagency;

/**
*
* AccountsIterator interface
*/
public interface AccountsIterator {
    public boolean hasNext();
    public Account next();
}

----------------------------------------

2. Car.java:

-----------------------------------------

package vehiclerentalagency;

/**
*
* Car class
*/
public class Car extends Vehicle{

    /**
     * Constructor
     */
    public Car() {
    }

    /**
     * Constructor
     * @param description
     * @param mpg
     * @param num
     * @param VIN
     * @param resv
     */
    public Car(String description, int mpg, String num, String VIN, Reservation resv) {
        super(description, mpg, num, VIN, resv);
    }

  
    @Override
    public String toString() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }  
}

---------------------------------------

3. Account.java

---------------------------------------

package vehiclerentalagency;

/**
*
* Account class
*/
class Account {
  
}

----------------------------------

4. CarRate.java

--------------------------------------

package vehiclerentalagency;

/**
*
* CarRate class
*/
public class CarRate extends VehicleRates{

    public CarRate() {
    }

    @Override
    double getDailyRate() {
        return 24.95;
    }

    @Override
    double getWeeklyRate() {
        return 149.95;
    }

    @Override
    double getMonthlyRate() {
        return 514.95;
    }

    @Override
    double getMilegeChrg() {
        return 0.15;
    }

    double getInsuranceRate()
    {
        return 14.95;
    }
}

-------------------------------------------

5. Corporate_Accounts.java

----------------------------------------

package vehiclerentalagency;

/**
*
* Corporate_Accounts class
*/
class Corporate_Accounts {
  
}

-------------------------------------------------

6. Cost.java:

-----------------------------------------------

package vehiclerentalagency;

/**
*
* Cost class
*/
public class Cost {
  
}

-----------------------------------------

7. Rates.java

package vehiclerentalagency;

/**
*
* Rates class
*/
class Rates {
  
}

--------------------------------

8. Reservation.java:

--------------------------------------

package vehiclerentalagency;

/**
*
* Reservation class
*/
class Reservation {
    private String companyName;
    private String creditCardNumber; //credit card number (reservations have
    private String acctNumber;      //either a credit card number or a company
                                    //account number stored  
    private String rentalReriodType; //days, weeks, months
    private String rentalDuration; //1,2,3,...(how many days, weeks, or months
                                   //reserving for)
    private boolean insuranceSelected; //set to true if optional daily insurance wanted

    /**
     * Constructor
     */
    public Reservation() {
        this.companyName = "";
        this.creditCardNumber = "";
        this.acctNumber = "";
        this.rentalReriodType = "";
        this.rentalDuration = "";
        this.insuranceSelected = false;
    }

    /**
     * Constructor
     * @param companyName
     * @param creditCardNumber
     * @param acctNumber
     * @param rentalReriodType
     * @param rentalDuration
     * @param insuranceSelected
     */
    public Reservation(String companyName, String creditCardNumber, String acctNumber, String rentalReriodType, String rentalDuration, boolean insuranceSelected) {
        this.companyName = companyName;
        this.creditCardNumber = creditCardNumber;
        this.acctNumber = acctNumber;
        this.rentalReriodType = rentalReriodType;
        this.rentalDuration = rentalDuration;
        this.insuranceSelected = insuranceSelected;
    }

    /**
     *
     * @return
     */
    public String getCompanyName() {
        return companyName;
    }

    /**
     *
     * @return
     */
    public String getCreditCardNumber() {
        return creditCardNumber;
    }

    /**
     *
     * @return
     */
    public String getAcctNumber() {
        return acctNumber;
    }

    /**
     *
     * @return
     */
    public String getRentalReriodType() {
        return rentalReriodType;
    }

    /**
     *
     * @return
     */
    public String getRentalDuration() {
        return rentalDuration;
    }

    /**
     *
     * @return
     */
    public boolean isInsuranceSelected() {
        return insuranceSelected;
    }

    @Override
    public String toString() {
        return "Reservation{" + "companyName=" + companyName + ", creditCardNumber=" + creditCardNumber + ", acctNumber=" + acctNumber + ", rentalReriodType=" + rentalReriodType + ", rentalDuration=" + rentalDuration + ", insuranceSelected=" + insuranceSelected + '}';
    }  
}

--------------------------------------

9. ReservationIterator.java

------------------------------------------

package vehiclerentalagency;

/**
*
* ReservationsIterator interface
*/
public interface ReservationsIterator {
    public boolean hasNext();
    public Reservation next();
}

-------------------------------

10. ReservedVehicleException.java

-------------------------------

package vehiclerentalagency;

/**
*
* ReservedVehicleException class
*/
class ReservedVehicleException extends Exception {

    public ReservedVehicleException(String message) {
        super(message);
    }  
}

----------------------------

11. SUV.java:

-------------------------------------

package vehiclerentalagency;

/**
*
* SUV class
*/
public class SUV extends Vehicle{

    /**
     * Constructor
     */
    public SUV() {
    }

    /**
     * Constructor
     * @param description
     * @param mpg
     * @param num
     * @param VIN
     * @param resv
     */
    public SUV(String description, int mpg, String num, String VIN, Reservation resv) {
        super(description, mpg, num, VIN, resv);
    }

  
    @Override
    public String toString() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }   
}

-------------------------------------

12. SUVRate.java

-----------------------------------

package vehiclerentalagency;

/**
*
* SUVRate class
*/
public class SUVRate extends VehicleRates{

    public SUVRate() {
    }

    @Override
    double getDailyRate() {
        return 29.95;
    }

    @Override
    double getWeeklyRate() {
        return 189.95;
    }

    @Override
    double getMonthlyRate() {
        return 679.95;
    }

    @Override
    double getMilegeChrg() {
        return 0.15;
    }

    double getInsuranceRate()
    {
        return 14.95;
    }
}

------------------------------------

13. TruckRate.java:

----------------------------------------

package vehiclerentalagency;

/**
*
* TruckRate class
*/
public class TruckRate extends VehicleRates{

    public TruckRate() {
    }

    @Override
    double getDailyRate() {
        return 34.95;
    }

    @Override
    double getWeeklyRate() {
        return 224.95;
    }

    @Override
    double getMonthlyRate() {
        return 797.95;
    }

    @Override
    double getMilegeChrg() {
        return 0.26;
    }

    double getInsuranceRate()
    {
        return 22.95;
    }
}

---------------------------------------

15. UnreservedVehicleException.java

------------------------------------------

package vehiclerentalagency;

/**
*
* UnreservedVehicleException class
*/
class UnreservedVehicleException extends Exception {

    public UnreservedVehicleException(String message) {
        super(message);
    }  
}

----------------------------------

16. UserInterface.java:

---------------------------------

package vehiclerentalagency;

/**
*
* UserInterface class
*/
class UserInterface {

    void start() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
  
}

--------------------------

17. Vehicle.java

-------------------------------

package vehiclerentalagency;

/**
*
* Vehicle class
*/
abstract class Vehicle {
    private String description; //make-model for cars, length for truks
    private int mpg; //miles per gallon
    private String num; //(num of seats, bench seats, number of rooms of storage)
    private String VIN; //unique vehicle identification number
    private Reservation resv; //if null, then vehicle not reserved

    /**
     * Constructor
     */
    public Vehicle() {
        description="";
        mpg=0;
        num="";
        VIN="";
        resv=null;
    }

    /**
     * Constructor
     * @param description
     * @param mpg
     * @param num
     * @param VIN
     * @param resv
     */
    public Vehicle(String description, int mpg, String num, String VIN, Reservation resv) {
        this.description = description;
        this.mpg = mpg;
        this.num = num;
        this.VIN = VIN;
        this.resv = resv;
    }
  
    public abstract String toString(); //abstract method

    /**
     * gets description
     * @return
     */
    public String getDescription() {
        return description;
    }

    /**
     * sets description
     * @param description
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * gets mpg
     * @return
     */   
    public int getMpg() {
        return mpg;
    }

    /**
     * sets mpg
     * @param mpg
     */
    public void setMpg(int mpg) {
        this.mpg = mpg;
    }

    /**
     * gets num
     * @return
     */
    public String getNum() {
        return num;
    }

    /**
     * sets num
     * @param num
     */
    public void setNum(String num) {
        this.num = num;
    }

    /**
     * gets VIN
     * @return
     */
    public String getVIN() {
        return VIN;
    }

    /**
     * sets VIN
     * @param VIN
     */
    public void setVIN(String VIN) {
        this.VIN = VIN;
    }

    /**
     * gets reservation
     * @return
     */
    public Reservation getResv() {
        return resv;
    }

    /**
     * sets reservation
     * @param resv
     */
    public void setResv(Reservation resv) {
        this.resv = resv;
    }
  
    /**
     * returns if vehicle is reserved.
     * @return
     */
    public boolean isReserved()
    {
        return (resv==null);
    }
  
    /**
     * reserves an unreserved vehicle
     * @param r
     * @throws ReservedVehicleException
     */
    public void reserve(Reservation r) throws ReservedVehicleException
    {
      
    }
  
    /**
     * cancels an already reserved vehicle
     * @throws UnreservedVehicleException
     */
    public void cancelReservation() throws UnreservedVehicleException
    {
      
    }
}

------------------------------

18. VehicleRates.java

--------------------------------

package vehiclerentalagency;

/**
*
* VehicleRates
*/

public abstract class VehicleRates extends Rates{
    abstract double getDailyRate(); //cost per day
    abstract double getWeeklyRate(); //cost per week
    abstract double getMonthlyRate(); //cost per month
    abstract double getMilegeChrg(); //cost per mile, based on vehicle type  
}

---------------------------------

19. VehicleRentalAgency.java

-----------------------

package vehiclerentalagency;

/**
*
* VehicleRentalAgency class
*/
public class VehicleRentalAgency {

    private static Rates buildRates() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    private static void populateVehicles(Vehicles agency_vehicles) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    private static int promptForUIType() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    private static UserInterface buildUI(int UI_type) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
  
    //user interface types
    private final int PRIVATE_CUSTOMER_UI=1;
    private final int CORPORATE_CUSTOMER_UI=2;
    private final int MANAGER_UI=3;
  
    //initialized as empty aggregations
    private static Vehicles agency_vehicles;
    private static Corporate_Accounts agency_accounts;
  
    //initialized with hard-coded rates
    private static Rates agency_rates;
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        //initialize system
        agency_vehicles=new Vehicles(); //creates empty aggregation of vehicles
        agency_accounts=new Corporate_Accounts(); //creates empty aggregation of accounts
        agency_rates=buildRates(); //creates fixed hard-coded rates
      
        //create a collection of agency vehicles
        populateVehicles(agency_vehicles);
      
        //prompt for type of user interface
        int UI_type=promptForUIType();
      
        //create appropriate UI
        UserInterface ui=buildUI(UI_type);
      
        //start user interface
        ui.start();
    }
  
}

-------------------------

20. Vehicle.java:

package vehiclerentalagency;

/**
*
* Vehicles class
*/
class Vehicles {
  
}

--------------------------

21. VehiclesIterator.java:

-----------------------------

package vehiclerentalagency;

/**
*
* VehiclesIterator interface
*/
public interface VehiclesIterator {
    public boolean hasNext();
    public Vehicle next();
}

-----------------------------------