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 nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images
- For all questions, you can assume that the following $() function is available:const $ = selector => document.querySelector(selector); Which of the following statements is NOT true? To display changes made to the DOM, you must refresh the web page. The DOM for a web page is built as the page is loaded by the web browser. The DOM is a hierarchical collection of nodes in the web browser’s memory. You can modify the DOM using the properties and methods that are defined by the DOM Core specification.arrow_forward18. What is the best data type definition for Oracle when a field is alphanumeric and has a length that can vary? a. VARCHAR2 b. CHAR c. LONG d. NUMBERarrow_forwardHow would you modify these Query files to work with the food_wastage_record.h file FoodWastageRecord QueryStringToFoodWastageRecord( const crow::query_string &query_string) { FoodWastageRecord record; // TODO 1. Get the date from the query_string using query_string.get("date"), // and set it in the `record` object using the setter in FoodWastageRecord // class. // TODO 2. Get the meal from the query_string using query_string.get("meal"), // and set it in the `record` object using the setter in FoodWastageRecord // class. // TODO 3. Get the food name from the query_string using // query_string.get("food_name"), and set it in the `record` object using the // setter in FoodWastageRecord class. // TODO 4. Get the quantity from the query_string using // std::stod(query_string.get("qty_in_oz")), and set it in the `record` object // using the setter in FoodWastageRecord class. // TODO 5. Get the wastage reason from the query_string using //…arrow_forward
- The following is a preview of the DataFrames df_1. Which of the following statement(s) are true? df_1 date temperature humidity 2018/01/01 70 85 2018/01/02 68 80 2018/01/03 71 80 df_1 is in long format because each row represents an observation and each column represents a variable. df_1 is in wide format, i.e, each row is 1 record of an observation and each column represents a feature about a record. A dataframe cannot be seen as a table.arrow_forwardTask 4: The InstantRide User Satisfaction team is a core team for InstantRide, and they focus on increasing the customer satisfaction. They want to learn the travel time for each ride in the system. You need to return the USER_ID, and the TRAVEL_TIME column which is calculated using the TIMEDIFF function on the TRAVEL_END_TIME and the TRAVEL_START_TIME.arrow_forwardFor questions below, use the following nested data structure to answer the questions. social_network = {'bb_dawg$': ('Barry Bowden', 18, ['New York City NY', 'Langley VA'], ['Elisa Yang', 'Andrew Yamins', 'James Butler']), 'yo_jimbo2000': ('James Butler', 21, ['Boston MA'], ['Barry Bowden']), 'e_yan2002': ('Elisa Yan', 20, ['College Park MD', 'Clarksburg MD'], ['Andrew Yamins', 'Barry Bowden']), 'bmansford1990': ('Benard Mansford', 31, ['San Jose CA', 'College Park MD'], []), 'derp1234': ('who cares', 99, ['College Park MD'], [])} Q1) Notice that a removed user ('Andrew Yamins') is still contained in the friends list of a few users. Write a few lines of code to remove him from those friends lists in the social network. Q2) Write a short Python function called find_user_lived that takes a string as input along with the social network data structure; the string should be a city and state and the function should…arrow_forward
- In pythonarrow_forwardBased on the table below, what values would appear in the range D3:F5 when the contents of C3:C5 are autofilled rightward towards column F? 1 2 3 4 5 A Blank # 1 Blank # 2 Blank #3 Blank # 4 Blank # 5 Blank # 6 Blank # 7 Blank # 8 Blank # 9 8 Initial Values C3=C$2*3 C4=$C2*3 C5=$C$2*3 C 1 3 3 3 D 2 Blank # 1 Blank # 4 Blank #7 E 3 Blank # 2 Blank # 5 Blank # 8 4 Blank # 3 Blank # 6 Blank # 9 A/ F A A/ A N A 신 A A/arrow_forwardThe file transactions.txt contains rows of transactions. Each transaction (row) consists of a start month,end month and name. Each of these three values is a String.In the following tasks you are asked to read and store the transactions from the file and determine if thereare any duplicate transactions. A transaction is a duplicate if all three values are the same as the threevalues of any other transaction.a. add code to your main method that reads the content of transactions.txt and stores itin a two-dimensional String array. The name of the String array is your choice. Note that you maynot assume that the number of rows in transactions.txt will always be the same. However, youmay assume that there will always be three String values on a single row. The first dimension of yourtwo-dimensional array must be resized dynamically each time a new record is read (Hint: we did thisin class with a single dimensional array and this is very, very similar). Your code will be evaluatedwith rows…arrow_forward
- Task 12: When deleting a customer, subtract the balance multiplied by the sales rep’s commission rate from the commission for the corresponding sales rep.arrow_forwardThere's a "users" table and "messages" table included in the image. Implement a SQL query to return which users have more than 10 unread messages (NULL in the "date_read" column).arrow_forward3. Which among the following shows a valid use of the Direction enumeration as a parameter to the moveCharacter function? Select al that apply. enum Direction { case north, south, west, east}func moveCharacter(x: Int, y: Int, facing: Direction) {// code here} moveCharacter(x: 0, y: 0, facing: .southwest) moveCharacter(x: 0, y: 0, facing: Direction.north) moveCharacter(x: 0, y: 0, facing: .south) moveCharacter(x: 0, y: 0, facing: Direction.northeast)arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY