Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A file named Fruit.txt contains unknown number of fruit (maximum number of fruit is 50). Each line in the file contains fruit name (string),

A file named

A file named "Fruit.txt" contains unknown number of fruit (maximum number of fruit is 50). Each line in the file contains fruit name (string), weight in kilograms (int) and price per kilogram (float). Write a C++ program that reads the data into 3 parallel arrays. Your program should display the following: 1. the number of fruit in the file 2. the amount of price for each fruit in the file 3. the highest amount of price with the name of the fruit Format the amount of price to 3 decimal places. Sample Input/output of the program is shown in the example below: KALK Fruit.txt (Input file) 0.800 0.650 1.050 Apple Banana Mangos Strawberry 4 129 (Amount-weight in kilograms price per kilogram) 13 25 10 0.900 Screen Output There are 11 fruit in the file. Fruit Apple Banana Mangos **** Amount 10.400 16.250 10.500 Strawberry Banana has the highest amount of price - 16.250 3.600

Step by Step Solution

There are 3 Steps involved in it

Step: 1

include include include include using namespace std int main declare variables constants and arrays ... 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

Step: 3

blur-text-image

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

Cost Accounting A Managerial Emphasis

Authors: Horngren, Srikant Datar, George Foster, Madhav Rajan, Christ

6th Canadian edition

978-0132893534, 9780133389401, 132893533, 133389405, 978-0133392883