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
prisoha [69]
3 years ago
8

Given two integers as user inputs that represent the number of drinks to buy and the number of bottles to restock, create a Vend

ingMachine object that performs the following operations:
Purchases input number of drinks Restocks input number of bottles.
Reports inventory Review the definition of "VendingMachine.cpp" by clicking on the orange arrow.
A VendingMachine's initial inventory is 20 drinks.

Ex: If the input is: 5 2
the output is: Inventory: 17 bottles
Computers and Technology
1 answer:
ivann1987 [24]3 years ago
8 0

Answer:

In C++:

#include <iostream>

using namespace std;

class VendingMachine {

 public:

   int initial = 20;};

int main() {

 VendingMachine myMachine;

   int purchase, restock;

   cout<<"Purchase: ";  cin>>purchase;

   cout<<"Restock: ";  cin>>restock;

   myMachine.initial-=(purchase-restock);

   cout << "Inventory: "<<myMachine.initial<<" bottles";  

   return 0;}

Explanation:

This question is incomplete, as the original source file is not given; so, I write another from scratch.

This creates the VendingMachine class

class VendingMachine {

This represents the access specifier

 public:

This initializes the inventory to 20

   int initial = 20;};

The main begins here

int main() {

This creates the object of the VendingMachine class

 VendingMachine myMachine;

This declares the purchase and the restock

   int purchase, restock;

This gets input for purchase

   cout<<"Purchase: ";  cin>>purchase;

This gets input for restock

   cout<<"Restock: ";  cin>>restock;

This calculates the new inventory

   myMachine.initial-=(purchase-restock);

This prints the new inventory

   cout << "Inventory: "<<myMachine.initial<<" bottles";  

   return 0;}

You might be interested in
Based on this information, what is their gross income for six months? Roderick
alexira [117]
Multiply what he makes a month by six
8 0
3 years ago
Which of these statements most accurately describes cookies?
horsena [70]
A cookie(s), on a website, is a small text file that is placed on a computer by a website. Most websites online use cookies to track data. A person can turn off their cookie tracking by going into the settings and turning it off. You can directly choose to not have cookies placed on your computer or phone. However, some website does require the cookies to be enabled before you can visit the website. The correct answer will be C. 
5 0
3 years ago
How can I identify what is and what isn't an IP Address?
adelina 88 [10]

Answer:

you can identify an ip address in the bar where u type links

Explanation:

7 0
3 years ago
Careful driving requires appropriate reaction time, both simple and complex. Braking and then shifting gears, followed by signal
QveST [7]
The correct answer is complex.
There are two types of reaction times when it comes to driving - simple and complex. Simple reaction time refers to your action after receiving some sort of a stimulus - when you see the red light, you are supposed to break. When it comes to complex reaction time, however, it has to do with your assessment of the situation, and realization what it is you have to do in order to avoid an accident, for example. 
4 0
3 years ago
Read 2 more answers
Express the following binary numbers in hexadecimal. (a) %100011100101 (b) %1011001111 (show work)
Lapatulllka [165]

Answer:

(100011100101)_{2} = (8E5)_{16} = %8E5

(1011001111) = (2CF)_{16} = %2CF

Explanation:

Binary and hexadecimal values have the following pair equivalences.

(0000)_{2} = (0)_{16}

(0001)_{2} = (1)_{16}

(0010)_{2} = (2)_{16}

(0011)_{2} = (3)_{16}

(0100)_{2} = (4)_{16}

(0101)_{2} = (5)_{16}

(0110)_{2} = (6)_{16}

(0111)_{2} = (7)_{16}

(1000)_{2} = (8)_{16}

(1001)_{2} = (9)_{16}

(1010)_{2} = (A)_{16}

(1011)_{2} = (B)_{16}

(1100)_{2} = (C)_{16}

(1101)_{2} = (D)_{16}

(1110)_{2} = (E)_{16}

(1111)_{2} = (F)_{16}

We convert from binary to hexadecimal selecting groups of 4 binary from the binary code, from the least significant bits(at the right) to the most significant bits(at the left). The conversion is an hexadecimal "string" from the last group you converted to the first. So:

(a) %100011100101

(0101)_{2} = (5)_{16}

(1110)_{2} = (E)_{16}

(1000)_{2} = (8)_{16}

So

(100011100101)_{2} = (8E5)_{16}

(b) %1011001111

(1111)_{2} = F_{16}

(1100)_{2} = C_{16}

(10)_{2} = (0010)_{2} = 2_{16}

(1011001111) = (2CF)_{16}

7 0
3 years ago
Other questions:
  • Which step of creating a financial budget involves listing the payroll, rental, and utility costs?
    10·2 answers
  • To download a webpage, the web browser copies files and transfer them to your ____
    14·2 answers
  • Can someone please give me two (2) thesis statement for this question?
    5·1 answer
  • Green computing involves reducing electricity consumed and environmental waste generated when using a computer. which of the fol
    5·1 answer
  • What soft ware can you use to erase all of your data from a hard drive safely
    13·1 answer
  • The best way to ensure the accuracy and safety of your accounts is to:
    10·1 answer
  • You wrote a program to compare the portion of drivers who were on the phone. Which statements are true? Select 4 options.
    12·1 answer
  • What are the impacts of mobile phone?as well as the positive and negative impacts?​
    5·1 answer
  • Find the mean median mode and range of the data set <br> 11, 13,11,12 10 ,12,11,8
    10·1 answer
  • Which directory stores the cron configuration file?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!