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
-
Corning-Howell reported taxable income in 2024 of $164 million. At December 31, 2024, the reported amount of some assets and liabilities in the financial statements differed from their tax bases as...
-
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...
-
You are asked to choose between two options about which you know nothing except that they involve multiple attributes. If you could ask one binary response question to make your decision, what would...
-
Suppose the P-value in a right-tailed test is 0.0092. Based on the same population, sample, and null hypothesis, what is the P-value for a corresponding two-tailed test?
-
On July 2, the 2-month futures rate of the Mexican peso contained a 2 percent discount (unannualized). There was a call option on pesos with an exercise price that was equal to the spot rate. There...
-
The unadjusted trial balance of Canton Air Purification System at December 31, 2014, and the data needed for the adjustments follow. Adjustment data at December 31 follow: a. On December 15, Canton...
-
16. The intangible assets section of Pride Company at Dec.31, 2010 is presented below: Intangible assets Patent ($300,000 cost less $30,000 amortization) $270,000 Franchise ($180,000 cost less...
-
Write an effective reply for this discussion: Reply this discussion: What scares me the most about presenting in front of the class is two things: all eyes being on me and forgetting what I want to...
-
To what extent are the determinants and characteristics of audit quality similar to those of the audit expectations gap?
-
Identify business risk factors that might alert the auditor to an increased risk of fraud occurring within an audit client.
-
The Diversity Council of Australia (DCA) is the exemplary, not-for-profit peak body advocating for workplace diversity and inclusion in Australia.1 It has over 1000 member employers who collectively...
-
Discuss key elements that are important drivers of audit quality and evaluate whether an audit firm could reasonably be expected to identify key performance indicators against which audit quality...
-
Placing limitations on auditors liability for negligent misstatements is likely to result in a reduction in the quality of auditing. Discuss.
-
Pinnacle Corp. budgeted $239,490 of overhead cost for the current year. Actual overhead costs for the year were $207,190. Pinnacle's plantwide allocation base, machine hours, was budgeted at 53,820...
-
$10,000 was borrowed at 3.5% on July 17. The borrower repaid $5000 on August 12, and $2000 on September 18. What final payment is required on November 12 to fully repay the loan?
-
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,...
-
What factors should be taken into account when designing a system of accounting for inflation?
-
Historical cost accounting is the worst possible accounting convention, until one considers the alternatives. Discuss this statement in relation to CPP, CCA and NRVA.
-
Discuss the effect on setting performance bonuses for staff if financial performance for a period contains both realised and unrealised gains/losses.
Study smarter with the SolutionInn App