![Computers and Technology](/tpl/images/cats/informatica.png)
Computers and Technology, 16.06.2021 14:00, layshjjbradshaw7250
Need this java code its on zybooks. Given two integers as user inputs that represent the number of drinks to buy and the number of bottles to restock, create a VendingMachine object that performs the following operations:
Purchases input number of drinks
Restocks input number of bottles
Reports inventory
The vending machine is found in VendingMachine. java. A VendingMachine's initial inventory is 20 drinks.
Ex: If the input is:
5 2
the output is:
Inventory: 17 bottles.
The file that comes with it:
// simulates a simple vending machine with operations to purchase drinks and check inventory.
public class VendingMachine {
// number of bottle in stock
private int bottles;
// initial inventory is 20
public VendingMachine(){
bottles = 20;
}
public void purchase(int amount){
bottles = bottles - amount;
}
public int getInventory(){
return bottles;
}
public void restock(int amount){
bottles = bottles + amount;
}
public void report(){
System. out. println("Inventory: " + bottles + " bottles");
}
}
![answer](/tpl/images/cats/otvet.png)
Answers: 1
Other questions on the subject: Computers and Technology
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 00:00, brooklyn4932
What engine component is shown in the above figure?
Answers: 1
Do you know the correct answer?
Need this java code its on zybooks. Given two integers as user inputs that represent the number of d...
Questions in other subjects:
![Konu](/tpl/images/cats/en.png)
English, 21.10.2019 19:50
![Konu](/tpl/images/cats/en.png)
![Konu](/tpl/images/cats/biologiya.png)
Biology, 21.10.2019 19:50
![Konu](/tpl/images/cats/biologiya.png)
Biology, 21.10.2019 19:50
![Konu](/tpl/images/cats/informatica.png)
Computers and Technology, 21.10.2019 19:50
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/istoriya.png)
![Konu](/tpl/images/cats/mkx.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 21.10.2019 20:00