in c++ please Digicup This program simulates interactions with a cup object for getting a drink, refilling
Fantastic news! We've Found the answer you've been seeking!
Question:
in c++ please
Transcribed Image Text:
Digicup This program simulates interactions with a cup object for getting a drink, refilling a drink, emptying a drink, and drinking from it. Output All of the output statements (std::cout) should be in main and are mostly provided for you. You will only need to complete missing logic to construct a cup object and call the appropriate member functions in the cup class. The Cup object will be used to ask the user for the type of drink they prefer and the amount they want to drink. The menu options are shown below for your reference: D: Drink R: Refill N: Get a brand new drink E: Empty X: Exit The Cup class State (member variables) Create a class called Cup with the following member variables: 1. drink_type which is a std::string that will be the name of the drink. 2. fluid oz which is a double that will be the amount of fluid in the cup. Constructors Default constructor The default constructor should initialize drink_type_ to "Water" and initialize fluid_oz_ to 16.0 Non-default constructor The non-default constructor should take in a std::string parameter that will be the name of the drink type and a double parameter that will be the amount of drink in the cup in fluid ounces. It should set the passed parameter values to the corresponding data members. Member functions & Drink Create a function called Drink which accepts one double as a parameter. Drinking reduces the amount of liquid in the cup based on a given double that is passed as input. Take note that fluid_oz_ should never be negative, so if you drink an amount that is greater than fluid_oz_, then fluid oz should be set to 0. Refill Create a function called Refill which accepts one double as a parameter. Refilling the cup increases the amount of liquid in the Cup based on the given input. Assume the cup is bottomless. NewDrink Digicup This program simulates interactions with a cup object for getting a drink, refilling a drink, emptying a drink, and drinking from it. Output All of the output statements (std::cout) should be in main and are mostly provided for you. You will only need to complete missing logic to construct a cup object and call the appropriate member functions in the cup class. The Cup object will be used to ask the user for the type of drink they prefer and the amount they want to drink. The menu options are shown below for your reference: D: Drink R: Refill N: Get a brand new drink E: Empty X: Exit The Cup class State (member variables) Create a class called Cup with the following member variables: 1. drink_type which is a std::string that will be the name of the drink. 2. fluid oz which is a double that will be the amount of fluid in the cup. Constructors Default constructor The default constructor should initialize drink_type_ to "Water" and initialize fluid_oz_ to 16.0 Non-default constructor The non-default constructor should take in a std::string parameter that will be the name of the drink type and a double parameter that will be the amount of drink in the cup in fluid ounces. It should set the passed parameter values to the corresponding data members. Member functions & Drink Create a function called Drink which accepts one double as a parameter. Drinking reduces the amount of liquid in the cup based on a given double that is passed as input. Take note that fluid_oz_ should never be negative, so if you drink an amount that is greater than fluid_oz_, then fluid oz should be set to 0. Refill Create a function called Refill which accepts one double as a parameter. Refilling the cup increases the amount of liquid in the Cup based on the given input. Assume the cup is bottomless. NewDrink
Expert Answer:
Related Book For
Measurement Theory In Action
ISBN: 9780367192181
3rd Edition
Authors: Kenneth S Shultz, David Whitney, Michael J Zickar
Posted Date:
Students also viewed these programming questions
-
Our first program will give you an opportunity to work with a simple class in Java. You can use any development environment of your choice. You will only need to submit the .java file. Specifications...
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Determine whether each of these statements is true or false. a) x {x} b) {x} {x} c) {x} {x} d) {x} {{x}} e) {x} f) {x}
-
What organizational changes are necessary in order to implement the long-term plan derived in question number three above?
-
Planning is much more vital than control. Do you agree? Explain.
-
True or False: For personal investment decision making, rates of return are used more frequently than present worth.
-
The management of Kunkel Company is considering the purchase of a $40,000 machine that would reduce operating costs by $7,000 per year. At the end of the machines eight-year useful life, it will have...
-
Write the following expression in expanded form. (x+5)4 In (x-1)x+2
-
Provide a summary of the article entitled "University of Chicago Researchers Find That Blind Children Use Gestures Just as Sighted People Do" in the Week 1 Learning Resources. 2. How do gestures...
-
Consider the following monopoly with P = 30.5 -2.75 Q and the marginal cost curve is MC=4.5Q; a.Calculate the consumer surplus under the monopoly. b. Calculate the producer surplus under the...
-
A rod (Body 3) slides through a collar (Body 2) which is held by a rotating fork (Body 1). Body 3 can be treated as a slender rod, while bodies 1 and 2 are massless. A force F acts at end B and...
-
Represent the gcd (252, 198) as a linear combination of 252 and 198. Show all work. (For example, if X is the gcd, then solution is X = 252a + 198 b) Compute 325 mod 35 using the algorithm for (fast)...
-
a) Suppose you need to represent the following information in a database. Now draw an ER Diagram with proper symbols identifying different types of attributes used: MOVIE Movie_name Year Genre...
-
a first faces the demand curve, Q=180-5p, and has the cost equation, c=100+24Q. what is the equation for the firm's marginal revenue?
-
Im am interested in a 6 page APA format paper. 2/6 pages has to be the abstract page and reference page. Topic: Overworked and underpaid teachers.
-
Cable Corporation is 60% owned by Anna and 40% owned by Jim, who are unrelated. It has noncash assets, which it sells to an unrelated purchaser for $100,000 in cash and $900,000 in installment...
-
What is the difference between a fixed and a random facet?
-
In what ways do Anderson and Krathwohl (2001) revision differ from Blooms original taxonomy?
-
It was noted that if a test taker can eliminate at least one of the distracters, then corrections for guessing underestimate the extent of guessing. Is it possible to overestimate the extent of...
-
Solve the matrix equation \([\mathbf{K}]\{\mathbf{Q}\}=\{\mathbf{F}\}\) using forward reduction and backward substitution, where, 5-10 [K] = -13-1 0-1 1 {F}= 0
-
Volunteer work can improve your skills and enhance your rsum. With a partner, seek volunteer opportunities on your campus or in your city. Make a list of volunteer groups that may need help. Here are...
-
What are six brainstorming questions to consider before starting your proposal?
Study smarter with the SolutionInn App