menu
Qamnty
Login
Register
My account
Edit my Profile
Private messages
My favorites
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 ob…
Ask a Question
Questions
Unanswered
Tags
Ask a Question
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 ob…
asked
Dec 9, 2023
2.8k
views
24
votes
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");
}
}
Computers & Tech
high-school
Kenny Body
asked
by
Kenny Body
8.2k
points
answer
comment
share this
share
0 Comments
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1
Answer
6
votes
Answer:
5 bottles left and plus the amount of water they used
Step-by-step explanation:
Chao Ruan
answered
Dec 16, 2023
by
Chao Ruan
8.6k
points
ask related question
comment
share this
0 Comments
Please
log in
or
register
to add a comment.
← Prev Question
Next Question →
Related questions
asked
Feb 11, 2022
75.3k
views
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
Koelkastfilosoof
asked
Feb 11, 2022
by
Koelkastfilosoof
8.0k
points
Computers & Tech
college
2
answers
3
votes
75.3k
views
asked
Jun 18, 2024
192k
views
Select any tool that provides statement and decision code coverage. Utilizing the VendingMachine.java code Download VendingMachine.java codegiven to you, develop a set of test cases using JUnit for your
Darwayne
asked
Jun 18, 2024
by
Darwayne
8.2k
points
Computers & Tech
high-school
1
answer
0
votes
192k
views
asked
Mar 21, 2024
133k
views
Java ZyBooks: CHALLENGE ACTIVITY 9.3.2: Reading from a string. Write code that uses the input string stream inSS to read input data from string userInput, and updates variables userMonth, userDate, and
Deepblue
asked
Mar 21, 2024
by
Deepblue
7.8k
points
Computers & Tech
college
1
answer
4
votes
133k
views
Ask a Question
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.
Categories
All categories
Mathematics
(3.7m)
History
(955k)
English
(903k)
Biology
(716k)
Chemistry
(440k)
Physics
(405k)
Social Studies
(564k)
Advanced Placement
(27.5k)
SAT
(19.1k)
Geography
(146k)
Health
(283k)
Arts
(107k)
Business
(468k)
Computers & Tech
(195k)
French
(33.9k)
German
(4.9k)
Spanish
(174k)
Medicine
(125k)
Law
(53.4k)
Engineering
(74.2k)
Other Questions
“What does it mean when we “rework” copyrighted material?”
The book shows how to add and subtract binary and decimal numbers. However, other numbering systems are also very popular when dealing with computers. The octal (base 8) numbering system is one of these.
Seven basic internal components found in a computer tower
Twitter
WhatsApp
Facebook
Reddit
LinkedIn
Email
Link Copied!
Copy
Search Qamnty