Question: In the class definition, initialize the private fields renter ( string ) , mileage ( integer ) , and weekendPrice ( character ) with the
In the class definition, initialize the private fields renter string mileage integer and weekendPrice character with the default values "Incomplete", and N respectively. private Your code goes here
private Your code goes here
public void setRenterString rentalCarRenter
public void setMileageint rentalCarMileage
public void setWeekendPricechar rentalCarWeekendPrice
public void print
Svstem.out.orintlnRenter: renter Mileage: mileage Weekend orice: weekendPrice: public class Dealership Scanner scnr new ScannerSystemin; int newMileage; RentalCar myRentalCar new RentalCar; myRentalCar.print; newMileage scnrnextInt; myRentalCar.setRenternewRenter;
Ex: If the input is Del Y then the output is:
Default values:
Renter: Incomplete, Mileage: Weekend price: N
After mutator methods:
Renter: Del, Mileage: Weekend price: Y
Note: The class's print method is called before and after the input is passed to the setters.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
