1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AleksAgata [21]
2 years ago
14

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 and Technology
1 answer:
grandymaker [24]2 years ago
7 0

Answer:

5 bottles left and plus the amount of water they used

Explanation:

You might be interested in
WILL GIVE Brainliest!!!!
12345 [234]

Answer:

start

Explanation:

5 0
2 years ago
Read 2 more answers
a 50.5 force is applied to a golf ball generating an initial acceleration of 15 m/s2 caculate the mass of the golf ball.
siniylev [52]

Answer:

Mass = 3.37 Kg

Explanation:

<u>Given the following data;</u>

Force = 50.5N

Acceleration = 15m/s²

To find the mass of the golf ball;

Force is given by the multiplication of mass and acceleration.

Mathematically, the formula for force is;

F = ma

Where;

  • F represents force measured in Newton.
  • m represents the mass of an object measured in kilograms.
  • a represents acceleration measured in meter per seconds square.

Making mass (m) the subject of formula, we have;

Mass (m) = \frac{F}{a}

Substituting into the equation;

Mass (m) = \frac{50.5}{15}

<em>Mass = 3.37 Kg</em>

7 0
3 years ago
Which of the following choices BEST explains the purpose of developing a research plan?
ira [324]

Answer:

C

Explanation:

Because the research is for everybody

4 0
3 years ago
I want to solve this question in C program, Please.
inn [45]

Answer:

#include <stdio.h>

#include <math.h>

int is_armstrong(int n) {

int cubedSum = 0;

int r = n;

while (r) {

         cubedSum += (int)pow(r % 10, 3);

          r = r / 10;

}

return cubedSum == n;

}

int stack_count(int n) {

int sum = 0;

while (n) {

         sum += n % 10;

         n = n / 10;

}

return sum;

}

int is_magical(int n) {

while (n > 9) {  

 n = stack_count(n);

 printf("%d ", n);

}

return n == 1;

}

int main()

{

int input = 0;

int isMagical, isArmstrong;

while (true) {

 printf("Enter a number: ");

 scanf_s("%d", &input, sizeof(int));

 if (input == -1) break;

 isArmstrong = is_armstrong(input);

 isMagical = is_magical(input);  

 if (isArmstrong && isMagical) {

  printf("%d is both an armstrong and a magical number.\n", input);

 } else if (isArmstrong) {

  printf("%d is an armstrong number\n", input);

 } else if (isMagical) {

  printf("%d is a magical number\n", input);

 } else {

  printf("%d is neither an armstrong or a magical number.\n", input);

 }

}

}

Explanation:

Here is a starting point. What's the definition of a magical number?

4 0
3 years ago
Josh wrote the following e-mail to his co-worker. PLEASE HELP QUWICK
Vedmedyk [2.9K]

Answer:

Answer choice 4

Explanation:

If Josh sends an e-mail to his... co-<em>worker</em>.... wouldn't that be... <em>work</em>place communication?

3 0
3 years ago
Read 2 more answers
Other questions:
  • What does nat stand for? network access trigger network administration timetable network address translation network association
    13·1 answer
  • Create a class called Home that contains 4 pieces of information as instance variables: county (datatype string), street (dataty
    5·1 answer
  • Create a loop that will output all the numbers less than 200 that are evenly divisible (meaning remainder is zero) by both 5 and
    5·1 answer
  • Hiding data within pictures, audio, or video files can be difficult to detect and find. What can be done to reduce this?
    9·1 answer
  • My computer just fried anybody know why it did that?
    14·2 answers
  • Running the Disk Cleanup utility is a quick way to ________. Group of answer choices defrag your hard drive remove spyware progr
    10·1 answer
  • Match the data types to the types of value they are: Currency, Text, Date/time, and Name.
    11·1 answer
  • Is it true or false 1-5
    13·1 answer
  • A numbered list is best suited for steps that need to be done in _______________________ . [Create Bulleted and Numbered Lists]
    15·1 answer
  • In a stack, if a user tries to remove an element from an empty stack it is called.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!