Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ A supermarket is a self-service shop offering a wide variety of food and household products. A file named Compare.txt contains unknown number of products

C++ image text in transcribed
A supermarket is a self-service shop offering a wide variety of food and household products. A file named Compare.txt contains unknown number of products records in two giant supermarkets (maximum number of records is 100). Each line in the file consists of product name (string), product price in supermarket one (float), product price in supermarket two (float) respectively. Write a program that reads the data from the file into 3 parallel arrays. Your program should calculate and display the following (see sample file and screen output below): The number of products in supermarket one priced cheaper priced higher and priced equal to same products in supermarket two. Calculate Avgl to equal the average price for all products in supermarket one. Calculate Avg2 to equal the average price for all products in supermarket two. . Find the highest product price of both stores. Find all product names to have a price (supermarket one or supermarket two) higher than Total average price. Total average price is calculated as follows: Screen Compare.txt (Input file) Output Shampoo 1 2.050 2.100 Potato SA 0.245 0.250 Chicken_FZ 1.400 1.350 Galaxy 0.3000.300 Fairy_LRG 0.980 1.050

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions