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

LAB 02 Bicycles The World\'s Greatest Cost Effective Healthy Green Fashionable T

ID: 3904010 • Letter: L

Question

LAB 02 Bicycles The World's Greatest Cost Effective Healthy Green Fashionable Transportation Solution Downtown Dalhs, Texas has seen an expbsion in a demand for bicycle rentas You have decided to go into the bcycle rental business to satsfy the world's desre for cost efective healthy green trarsportation. Market studies have shown that hundreds of bilions of people are interested in renting bicycles which wil resut in a huge number of rentas from your bicyce rental stores. You need to develbp a program that cakcuates the rental charge for a birycle rental based on the number of days the bicyce rented and the bkycle type. You must use the folowing package name for developing the Java program package biclyclerentalstorepackage: There must be at least 2 java source code files that love the folowing ames BicycleRentalStoreMainclass.java Contains the main BicyclestoreMainClass BicycleRentalclass.java Contains the BicycleRentalclass base chss and the extended chsses based on bicyce type. The program must create and use at least an amount of bicyce objects for each type of bicyce If you do not use this assignment's stated file names, chss names, method names, varable rames and package name, the asignment ban invalid submission and wil be graded a 0%. This program Introduces inherltance by creating subchsses of a BicycleRentalclass based on bicycle type. Your program design soktion will override the equals) and calculateRentalFees0 methods in the extended chsses

Explanation / Answer

**************************************************************

BicycleStoreMainClass.java

package bicyclerentalstorepackage;

public class BicycleStoreMainClass {

                enum BICYCLE_TYPE_ENUM {

                                STANDARD, RACES, MOUNTAIN, BMX

                }

                public class DAILY_BICYCLE_RENTL_RATES_CLASS {

                                public static final double RENTAL_DAILY_FEE_STANDARD = 1.00;

                                public static final double RENTAL_DAILY_FEE_RACER = 1.50;

                                public static final double RENTAL_DAILY_FEE_MOUNTAIN = 1.79;

                                public static final double RENTAL_DAILY_FEE_BMX = 1.89;

                }

                public static void main( String[] args ) {

                                BicycleRentalStandardClass standard_rental = new BicycleRentalStandardClass(1, BICYCLE_TYPE_ENUM.STANDARD);

                                System.out.println(" Bicycle Id : " + standard_rental.getbicycleId());

                                System.out.println(" Bicycle Id : " + standard_rental.getbicycleType());

                                System.out.println(" Rental fees for 5 days : " + standard_rental.calculateRentalFees(5));

                }

}

**************************************************************

BicycleRentalClass.java

package bicyclerentalstorepackage;

public abstract class BicycleRentalClass {

                private int bicycleId;

                private BicycleStoreMainClass.BICYCLE_TYPE_ENUM bicycleType;

                double bicycleRentalFee;

                public BicycleRentalClass(int bicycleId, BicycleStoreMainClass.BICYCLE_TYPE_ENUM bicycleType) {

                                this.bicycleId = bicycleId;

                                this.bicycleType = bicycleType;

                }

                public int getbicycleId() {

                                return bicycleId;

                }

                public void setbicycleId(int bicycleId) {

                                this.bicycleId = bicycleId;

                }

                public BicycleStoreMainClass.BICYCLE_TYPE_ENUM getbicycleType() {

                                return bicycleType;

                }

                public void setbicycleType(BicycleStoreMainClass.BICYCLE_TYPE_ENUM bicycleType) {

                                this.bicycleType = bicycleType;

                }

                public abstract double calculateRentalFees(int daysToRent);

                public boolean equals(BicycleRentalClass otherBicycleRentalClassObj) {

                                return bicycleId == otherBicycleRentalClassObj.bicycleId;

                }

}

**************************************************************

BicycleRentalStandardClass.java // The same way you can create rest 3 classes

package bicyclerentalstorepackage;

public class BicycleRentalStandardClass extends BicycleRentalClass {

                public BicycleRentalStandardClass(int bicycleId, BicycleStoreMainClass.BICYCLE_TYPE_ENUM bicycleType) {

                                super(bicycleId, bicycleType);

                }

                @Override

                public double calculateRentalFees(int daysToRent) {

                                if(getbicycleType() == BicycleStoreMainClass.BICYCLE_TYPE_ENUM.STANDARD)

                                                return BicycleStoreMainClass.DAILY_BICYCLE_RENTL_RATES_CLASS.RENTAL_DAILY_FEE_STANDARD * daysToRent;

                                else if(getbicycleType() == BicycleStoreMainClass.BICYCLE_TYPE_ENUM.MOUNTAIN)

                                                return BicycleStoreMainClass.DAILY_BICYCLE_RENTL_RATES_CLASS.RENTAL_DAILY_FEE_MOUNTAIN * daysToRent;

                                else if(getbicycleType() == BicycleStoreMainClass.BICYCLE_TYPE_ENUM.RACES)

                                                return BicycleStoreMainClass.DAILY_BICYCLE_RENTL_RATES_CLASS.RENTAL_DAILY_FEE_RACER * daysToRent;

                                else if(getbicycleType() == BicycleStoreMainClass.BICYCLE_TYPE_ENUM.BMX)

                                                return BicycleStoreMainClass.DAILY_BICYCLE_RENTL_RATES_CLASS.RENTAL_DAILY_FEE_BMX * daysToRent;

                                else

                                                return 0;

                }

}