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

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%

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

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
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