You have been developing programs for Cost Is No Object—a car rental service tha
ID: 3624564 • Letter: Y
Question
You have been developing programs for Cost Is No Object—a car rental service that specializes in lending antique and luxury cars to clients on a short-term basis. Assume you have decided that you will need the following classes: Name, Address, Date, Employee, Customer, Automobile, and RentalAgreement.Complete the classes listed below
Name
-firstName : string
-lastName : string
+set__________(fName : string) : void
+set__________ (lName : string) : void
+get__________ () : string
+get__________ () : string
Address
-streetAddress : string
-city : string
-state : string
-zipCode : string
+set__________ (add : string) : void
+set__________ (city : string) : void
+set__________ (st : string) : void
+set__________ (zip : string) : void
+getStreetAddress() : string
+getCity() : string
+getState() : string
+getZipCode() : string
Date
-month : num
-day : num
-year : num
+__________ (mn : num) : void
+__________ (dy : num) : void
+__________ (yr : num) : void
+getMonth() : num
+getDay() : num
+getYear() : num
Employee
-idNumber : string
-name : Name
-address : Address
-hireDate : Date
-hourlyPayRate : num
+__________ (id : string) : void
+__________ (nm : Name) : void
+__________ (add : Address) : void
+__________ (hDate : Date) : void
+__________ (rate : num) : void
+getIdNumber() : string
+getName() : Name
+getAddress() : Address
+getHireDate() : Date
+getHourlyPayRate() : num
Customer
-idNumber : string
-name : Name
-address : Address
+setIdNumber__________void
+setName__________void
+setAddress__________void
+getIdNumber() : string
+getName() : Name
+getAddress() : Address
Automoblie
-carId : string
-make : string
-year : num
+setCarId(id : string) : void
+setMake(mk : string) : void
+setYear(yr : num) : void
+__________ () : string
+__________ () : string
+__________ () : num
RentalAgreement
-rentalAgreementNumber : string
-renter : Customer
-rentalAgent : Employee
-rentalStartDate : Date
-carRented : Automobile
-dailyFee : num
-numberOfDaysRented : num
+setRentalAgreementNumber(number : string) : void
+setRenter(cust : Customer) : void
+setRentalAgent(emp : Employee) : void
+setRentalStartDate(startDate : Date) : void
+setCarRented(car : Automobile) : void
+setDailyFee(fee : num) : void
+setNumberOfDaysRented(days : num) : void
+get__________ () : string
+get__________ () : Customer
+get__________ () : Employee
+get__________ () : Date
+get__________ () : Automobile
+get__________ () : num
+get__________ () : num
More Object Concepts
Case: Cost Is No Object
1. In Chapter 7 you developed classes needed for Cost Is No Object—a car rental service that specializes in lending antique and luxury cars to clients on a short-term basis. You created the logic for the following classes: Name, Address, Date, Employee, Customer, Automobile, and RentalAgreement.
· Complete the superclass named Person from which both Employee and Customer descend from. Attributes and methods that any Person should possess—for example, a name and address are passed to the Employee and Customer classes. Then rewrite the Employee and Customer classes to descend from Person, including only attributes and methods appropriate for each subclass.
· class Person
· // Declarations
· private Name ______
· private Address ______
· public void setName(Name nm)
· ______ = nm
· return
· public void setAddress(Address ______)
· address = add
· return
· public Name getName()
· return ______
· public Address getAddress()
· return ______
· end______
· class Employee inheritsFrom ______
· // Declarations
· private string idNumber
· private Date hireDate
· protected num hourlyPayRate
· public void setIdNumber(string id)
· idNumber = ______
· return
· public void set______ (Date hDate)
· hireDate = ______
· return
· public void setHourlyPayRate(num rate)
· hourlyPayRate = ______
· return
· public string getIdNumber()
· return ______
· public Date getHireDate()
· return ______
· public num getHourlyPayRate()
· return ______
· endClass
· class Customer inheritsFrom Person
· // Declarations
· protected string idNumber
· public void setIdNumber(string id)
· idNumber = id
· return
· public string getIdNumber()
· return idNumber
· endClass
· class PartTimeEmployee inheritsFrom ______
· // Declarations
· private num weeklyHours
· private num taxRate
· class FullTimeEmployee inheritsFrom Employee
· // Declarations
· private num yearlySalary
· public void setYearlySalary(num sal)
· // Declarations
· num TOTAL_YRLY_HRS = 2080
· yearlySalary = ______
· hourlyPayRate = yearlySalary / TOTAL_YRLY_HRS
· return
· public void setHourlyPayRate(num rate)
· // Declarations
· num TOTAL_YRLY_HRS = 2080
· hourlyPayRate = rate
· yearlySalary = hourlyPayRate * TOTAL_YRLY_HRS
· return
· public num getYearlySalary()
· return yearlySalary
· endClass
Explanation / Answer
Dear user, Answers are highlighted with blue and bold. · class Person· // Declarations
· private Name name
· private Address address
· public void setName(Name nm)
· name= nm
· return
· public void setAddress(Address add)
· address = add
· return
· public Name getName()
· return name
· public Address getAddress()
· return address
· end Person
· class Employee inheritsFrom Person
· // Declarations
· private string idNumber
· private Date hireDate
· protected num hourlyPayRate
· public void setIdNumber(string id)
· idNumber =id
· return
· public void set HireDate (Date hDate)
· hireDate =hDate
· return
· public void setHourlyPayRate(num rate)
· hourlyPayRate = rate
· return
· public string getIdNumber()
· return idNumber
· public Date getHireDate()
· return hireDate
· public num getHourlyPayRate()
· return hourlyPayRate
· endClass
· class Customer inheritsFrom Person
· // Declarations
· protected string idNumber
· public void setIdNumber(string id)
· idNumber = id
· return
· public string getIdNumber()
· return idNumber
· endClass
· class PartTimeEmployee inheritsFrom Employee
· // Declarations
· private num weeklyHours
· private num taxRate
· class FullTimeEmployee inheritsFrom Employee
· // Declarations
· private num yearlySalary
· public void setYearlySalary(num sal)
· // Declarations
· num TOTAL_YRLY_HRS = 2080
· yearlySalary = 10000
· hourlyPayRate = yearlySalary / TOTAL_YRLY_HRS
· return
· public void setHourlyPayRate(num rate)
· // Declarations
· num TOTAL_YRLY_HRS = 2080
· hourlyPayRate = rate
· yearlySalary = hourlyPayRate * TOTAL_YRLY_HRS
· return
· public num getYearlySalary()
· return yearlySalary
· endClass
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.