Question: Suppose you have the interface Maintenance, below. There may be many classes such as Bulldozer, Excavator, or Loader that implement this interface. interface Maintenance

Suppose you have the interface Maintenance, below. There may be many classes

Suppose you have the interface Maintenance, below. There may be many classes such as Bulldozer, Excavator, or Loader that implement this interface. interface Maintenance { } double getAnnual Cost (); String getDescription(); Create a class Expenditures that represents a list of any kinds of yearly Maintenance. It has the methods below, plus a no-argument constructor that creates an empty list. You may forego import statements. // adds a Maintenance to this Expenditures public void addItem (Maintenance m) // finds the total cost of all annual maintenance in this. // Expenditures (0 if empty) public double findTotalPrice () // returns the maintenance cost of the first item in the // list that has the given description; returns if no // matching item is found public double findCost(String desc) // removes most recently added item; does nothing if the // list is empty public void remove () public class Expenditures {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer The Maintenance is a interface which has 2 methods are getAnnualCost and getDescription publi... View full answer

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!