Suppose you have a file Monster.txt that lists the Monster Energy Drinks the company offers, on one line and the price for a case of 24, with the customer ratings on a scale of 1-5 on the second line. The following shows the first few lines of the file: Monster Energy Nitro Super Dry Maximum Strength Drink 39.99 4.5 Monster Energy Ultra Red, Sugar Free Energy Drink 39.99 5 Red Bull Energy Drink, Zero 92.23 4.5 Red Bull Energy Drink, Coconut Berry 41.18 5 Monster Energy Juice, Pipeline Punch 34.98 5 Red Bull Energy Drink, Coconut Berry 41.18 5 The first line means the drink name is: Monster Energy Nitro Super Dry Maximum Strength and the second line means that a case of 24 cost $39.99 and it was rated 4.5/5. NOTE: WE DO NOT KNOW HOW MANY LINES THERE ARE IN THE FILE. Write the C++ program (with comments) that reads the data from the file, lists only those drinks rated 5 stars, and indicates if the five star drink comes with a free six pack or not. The customer gets a free six pack if the price of a carton of 24 is greater than $39.99. Write a function that will determines whether the customer will get a “free six pack”. If the file has ONLY the lines above, the output would be: Five Star Drinks: Monster Energy Ultra Red, Sugar Free Energy Drink 39.99 Red Bull Energy Drink, Coconut Berry 41.18 free six pack Monster Energy Juice, Pipeline Punch 34.98 Red Bull Energy Drink, Coconut Berry 41.18 free six pack
Suppose you have a file Monster.txt that lists the Monster Energy Drinks the company offers, on one line and the price for a case of 24, with the customer ratings on a scale of 1-5 on the second line.
The following shows the first few lines of the file:
Monster Energy Nitro Super Dry Maximum Strength Drink
39.99 4.5
Monster Energy Ultra Red, Sugar Free Energy Drink
39.99 5
Red Bull Energy Drink, Zero
92.23 4.5
Red Bull Energy Drink, Coconut Berry
41.18 5
Monster Energy Juice, Pipeline Punch
34.98 5
Red Bull Energy Drink, Coconut Berry
41.18 5
The first line means the drink name is: Monster Energy Nitro Super Dry Maximum Strength and the second line means that a case of 24 cost $39.99 and it was rated 4.5/5.
NOTE: WE DO NOT KNOW HOW MANY LINES THERE ARE IN THE FILE.
Write the C++ program (with comments) that reads the data from the file, lists only those drinks rated 5 stars, and indicates if the five star drink comes with a free six pack or not.
The customer gets a free six pack if the price of a carton of 24 is greater than $39.99. Write a function that will determines whether the customer will get a “free six pack”.
If the file has ONLY the lines above, the output would be:
Five Star Drinks:
Monster Energy Ultra Red, Sugar Free Energy Drink 39.99
Red Bull Energy Drink, Coconut Berry 41.18 free six pack
Monster Energy Juice, Pipeline Punch 34.98
Red Bull Energy Drink, Coconut Berry 41.18 free six pack
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images