Question: Q) (JAVA) Fill in the method inventoryCost() below for the partial class definition given. The method should total the cost of all the items remaining

Q) (JAVA) Fill in the method inventoryCost() below for the partial class definition given. The method should total the cost of all the items remaining in the machine. Assume class item has a getPrice() method that returns its cost as an int, as shown : public class Item{ .......... public int gertPrice() {.......} ..........

}

public class VendingMachine{ // _items holds all the items still in the machine privateItem[]_items; ....... // code here...

public int inventoryCost(){ ........... .......... } }

Step by Step Solution

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 Databases Questions!