a) Write the following method definition: i) Normal constructor for both subclasses. ii) Processor method named...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
a) Write the following method definition: i) Normal constructor for both subclasses. ii) Processor method named cale Coat() for both subclasses that calculate and return the total cost of the delivery that needs to be paid by the customer. The cost calculation is based on the following information: For SmallItemDelixexx, there are two types of vehicles that the customer can choose, either Motorcycle or Car. The fare per kilometer and cost for each additional stop for each vehicle is given below. Motorcycle Fare Car <5 km: RM5 < 15 km: RM2 per KM >= 5 km: RM1 per KM >= 15 km: RM1.50 per KM Additional stop RM1 per additional stop RM2 per additional stop For TexxxDelivexx, the delivery cost details are given in the table below. Fare Cold Truck Cost RM170 for the first 5 KM, and RM3 per KM after that RM120 Additional Stop RM10 per additional stop Helpers RM156 per helper Given the following template of abstract superclass named Relaxxxxxȧce and subclasses named SmallItemRelixxx and LexxxRelixxx public abstract class Relixxxsexxice { private String Name; private double distanseKM; private int additionalStar; //Methods: //constructors, accessor, printer public abstract double salsfrat); } public class mallitemRelixaxx extends Relixxxsexxȧse { private char xebislaxre // 'M' - Motorcycle, 'C' Car } //Methods: //constructors, accessor, printer public double calefet {-} //calculate delivery cost public class xxxlxxx extends Relaxxxxxice { private boolean soldTzuski private int numbelrexZ // refrigerated truck // number of moving helpers //Methods: //constructors, accessor, printer public double calefet {-} //calculate delivery cost a) Write the following method definition: i) Normal constructor for both subclasses. ii) Processor method named cale Coat() for both subclasses that calculate and return the total cost of the delivery that needs to be paid by the customer. The cost calculation is based on the following information: For SmallItemDelixexx, there are two types of vehicles that the customer can choose, either Motorcycle or Car. The fare per kilometer and cost for each additional stop for each vehicle is given below. Motorcycle Fare Car <5 km: RM5 < 15 km: RM2 per KM >= 5 km: RM1 per KM >= 15 km: RM1.50 per KM Additional stop RM1 per additional stop RM2 per additional stop For TexxxDelivexx, the delivery cost details are given in the table below. Fare Cold Truck Cost RM170 for the first 5 KM, and RM3 per KM after that RM120 Additional Stop RM10 per additional stop Helpers RM156 per helper Given the following template of abstract superclass named Relaxxxxxȧce and subclasses named SmallItemRelixxx and LexxxRelixxx public abstract class Relixxxsexxice { private String Name; private double distanseKM; private int additionalStar; //Methods: //constructors, accessor, printer public abstract double salsfrat); } public class mallitemRelixaxx extends Relixxxsexxȧse { private char xebislaxre // 'M' - Motorcycle, 'C' Car } //Methods: //constructors, accessor, printer public double calefet {-} //calculate delivery cost public class xxxlxxx extends Relaxxxxxice { private boolean soldTzuski private int numbelrexZ // refrigerated truck // number of moving helpers //Methods: //constructors, accessor, printer public double calefet {-} //calculate delivery cost
Expert Answer:
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
The Corporate Average Fuel Economy (CAFE) regulations were put into law by Congress in 1975 to promote the sale of fuel-efficient automobiles and light trucks. The law requires automakers to boost...
-
Required a. Use professional judgment in deciding on the preliminary judgment about materiality for earnings, current assets, current liabilities, and total assets. Your conclusions should be stated...
-
In a country with a fixed exchange rate system the rise of inflation will result in: O Home currency depreciation Currency appreciation in real terms Floating of home currency O Inflow of foreign...
-
How is DNA related to protein? a. Explain how nucleic acids are related to amino acids, and finally how amino acids make up a complete protein. b. Critical Thinking: Mutations arc changes to the...
-
Consult your solutions for Short Exercises 10-4 and 10-5. Requirements 1. Journalize salary expense and payment for College of San Bernardino related to the employment of Gloria Traxell. 2....
-
Consider the multiple linear regression model fit to the baseball data in Problem 3.41. Problem 3.41 Consider the 2016 major league baseball data in Table B.22. While team ERA0 was useful in...
-
This case, based on the balance sheet of Starbucks Corporation, will familiarize you with some of the assets and liabilities of that company. Visit www.pearsonhighered.com/Horngren to view a link to...
-
You just won a lottery that will pay you $2,500 a year for twenty years. You will receive your first payment today. If you can earn 8 percent on your money, what are your winnings worth to you today?
-
Suppose that the change in a portfolio value for a one-basis-point shift in the 1-year, 2-year, 3-year, 4-year, 5-year, 7-year, 10-year, and 30-year rates are (in $ million) +5, 3, 1, +2, +5, +7, +8,...
-
The following procedure performed by a candy manufacturer is the best example of a product level activity within a manufacturing cost hierarchy: Select one: a. Resetting the packaging equipment to...
-
Project Management Openings This case will address the changing human capital landscape in the industry. State of the Industry Deliver a comprehensive analysis of staffing concerns in the project...
-
Janet's employer provides her a company car. in exchange, janet pays a predetermined amount for personal use of the car. under the commuting value method, what is the least amount that janet must pay?
-
5) Simplify each of the following expressions: a) X.Y + X'.Y.Z' +Y.Z b) X.Y' +Z+(X'+Y).Z'
-
Assume the following goals have been set before the usability test: Fifty percent of users will be able to complete at least 5 tasks No user should make more than 5 errors for all the tasks More than...
-
What would a labor economist argue related to employer-provided health insurance?
-
Assume Company S1 sells land for $750,000 cash (with a carrying value of $ 150,000) to Company S2- neither are in real estate business and both are 100% owned by P Company (i.e. they are "sister"...
-
In a certain school district, 3% of the faculty use none of their sick days in a school year. Find the probability that 5 faculty members selected at random used no sick days in a given year.
-
Some scientists believe that carbon emissions, especially from the burning of fossil fuels, contribute significantly to global warming and that this can be combated if individuals take steps to limit...
-
Modify the List class of Fig. 21.3 to include method search that recursively searches a linked-list object for a specified value. The method should return a reference to the value if its found;...
-
Give the method header for each of the following methods: a) Method Hypotenuse, which takes two double-precision, floating-point arguments side1 and side2 and returns a double-precision,...
-
A probability experiment consists of rolling a single fair die. (a) Identify the outcomes of the probability experiment. (b) Determine the sample space. (c) Define the event E = roll an even number....
-
Sophia has three tickets to a concert, but Yolanda, Michael, Kevin, and Marissa all want to go to the concert with her. To be fair, Sophia randomly selects the two people who can go with her. (a)...
-
A pair of fair dice is rolled. Fair die are die where each outcome is equally likely. (a) Compute the probability of rolling a seven. (b) Compute the probability of rolling snake eyes; that is,...
Study smarter with the SolutionInn App