ou are required to create a class that represents the beverages sold in a coffee shop. Each  beverage can produce multiple cups at a specific price each. The name of the beverage  (product), number of cups that can be produced at a given day and the price per cup are  attributes of the CoffeeShop class and should be represented as parallel arrays in the class  with the size of 5. You will receive a CSV file called “List.csv” to populate the class’ data  members. The turnover data member must contain the total amount made per day. Now follow the UML class diagram and the description below and complete the CoffeeShop class.  CoffeeShop - products: string[] - quantity: int[] - price: int[] - shopName: string - turnover: double + CoffeeShop(string) + loadProducts(string): void + buy(double,string,int): bool + display(): void - search(string): int Attribute/Method Description Products quantity price Data members.  shopName turnover There are three parallel arrays. The products array  stores the names of the different beverages that are  sold in the coffee shop.  The quantity array stores the number cups that can be  made. The price array stores the price per unit. ShopName  which stores the name of the shop and the turnover  which must store the total amount made at the end of  the day. CoffeeShop(string) The constructor must receive the name of the shop as  parameter and assign it to the shop name. The method  must also assign default values to the parallel arrays.  loadProducts(string) This method must receive a file name as parameter  and must populate the parallel data members’ arrays  with information read from the file. A record in the file  will always be in the format of:  Products,quantity,price The first is the name of the product. The second is the quantity available. The third is the price per unit. NB: Use the getline() function when reading from the  file search(string) This private method is used to find the availability of a  particular product. It will receive the name of the  product as a parameter and will then find and return  the index of that product. If the product was not  found, then the method must return -1. buy(double,string,int) The method receives the amount tendered by the  customer, the name of the product, and the quantity  as parameters. The method must first check the  availability of the products, the quantity requested by  the customer, and also the amount tendered by the  customer if it is sufficient.  If the amount tendered is enough to buy and the  product is available in the amount tendered, an item is  purchased by decrementing the stock quantity at that  index and adding the total price calculated from that  index to the turnover. A Boolean true is returned if the  purchase was successful. If the purchase was not  successful a Boolean false is returned. display() This method must display the data in all arrays Create the following front-end function in a file called RunQ2.cpp. Please remember that you  may NOT duplicate any source code whose functionality already exists.  In the main() function you must:   Declare objects of type CoffeeShop that will be used throughout the program  and any variables needed.  Create the following menu that will repeat till the user chooses option 4. Coffee Shop Menu: ==================================== 1. Load Products 2. Buy a product 3. Display all product info 4. Exit………….. Menu Option Description 1 Load Products  Read from the file and populate the arrays. Confirm if the data was  loaded successful. 2 Buy Prompt the user for the name of the product, quantity and the  amount tendered. If the transaction was successful display  “Transaction successful”, otherwise display “Transaction  unsuccessful”. 3 Display  This option must display all the data in the arrays. The following  data must be displayed:  product  quantity  price 4 Terminate the program

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

You are required to create a class that represents the beverages sold in a coffee shop. Each 
beverage can produce multiple cups at a specific price each. The name of the beverage 
(product), number of cups that can be produced at a given day and the price per cup are 
attributes of the CoffeeShop class and should be represented as parallel arrays in the class 
with the size of 5. You will receive a CSV file called “List.csv” to populate the class’ data 
members. The turnover data member must contain the total amount made per day.
Now follow the UML class diagram and the description below and complete the CoffeeShop
class. 
CoffeeShop
- products: string[]
- quantity: int[]
- price: int[]
- shopName: string
- turnover: double
+ CoffeeShop(string)
+ loadProducts(string): void
+ buy(double,string,int): bool
+ display(): void
- search(string): int
Attribute/Method Description
Products
quantity
price
Data members. 
shopName
turnover
There are three parallel arrays. The products array 
stores the names of the different beverages that are 
sold in the coffee shop. 
The quantity array stores the number cups that can be 
made.
The price array stores the price per unit. ShopName 
which stores the name of the shop and the turnover 
which must store the total amount made at the end of 
the day.
CoffeeShop(string) The constructor must receive the name of the shop as 
parameter and assign it to the shop name. The method 
must also assign default values to the parallel arrays. 
loadProducts(string) This method must receive a file name as parameter 
and must populate the parallel data members’ arrays 
with information read from the file. A record in the file 
will always be in the format of:
 Products,quantity,price
The first is the name of the product.
The second is the quantity available.
The third is the price per unit.
NB: Use the getline() function when reading from the 
file
search(string) This private method is used to find the availability of a 
particular product. It will receive the name of the 
product as a parameter and will then find and return 
the index of that product. If the product was not 
found, then the method must return -1.
buy(double,string,int) The method receives the amount tendered by the 
customer, the name of the product, and the quantity 
as parameters. The method must first check the 
availability of the products, the quantity requested by 
the customer, and also the amount tendered by the 
customer if it is sufficient. 
If the amount tendered is enough to buy and the 
product is available in the amount tendered, an item is 
purchased by decrementing the stock quantity at that 
index and adding the total price calculated from that 
index to the turnover. A Boolean true is returned if the 
purchase was successful. If the purchase was not 
successful a Boolean false is returned.
display() This method must display the data in all arrays
Create the following front-end function in a file called RunQ2.cpp. Please remember that you 
may NOT duplicate any source code whose functionality already exists. 
In the main() function you must: 
 Declare objects of type CoffeeShop that will be used throughout the program 
and any variables needed.
 Create the following menu that will repeat till the user chooses option 4.
Coffee Shop Menu:
====================================
1. Load Products
2. Buy a product
3. Display all product info
4. Exit…………..
Menu Option Description
1 Load Products 
Read from the file and populate the arrays. Confirm if the data was 
loaded successful.
2 Buy
Prompt the user for the name of the product, quantity and the 
amount tendered. If the transaction was successful display 
“Transaction successful”, otherwise display “Transaction 
unsuccessful”.
3 Display 
This option must display all the data in the arrays. The following 
data must be displayed:
 product
 quantity
 price
4 Terminate the program

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY