Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a) Write the following method definition: i) Normal constructor for both subclasses. ii) Processor method named cale Coat() for both subclasses that calculate and

imageimage

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: 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 Relaxxxxxce 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 Relixxxsexxse { 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

Step by Step Solution

3.50 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Programming questions