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

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!