Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that reads a flat file of the following format. Input 42 1 John Curry 5 2345.34 345.40 569.89 4560.45 450.00 2

Write a C++ program that reads a flat file of the following format.

Input

42

1 John Curry 5 2345.34 345.40 569.89 4560.45 450.00

2 Abigail Right 0

3 Jack Monstrom 2 34569.00 3456.45

.

42 Evelyn Madim 0

Instructions

The number in the first row indicates the number of rows/managers in the file. In each row, the first number is the UIN of the manager followed by his first name and last name, the number of customers and the revenue for a month from each of his customers.

a) Write a function that prints the file into another file named Revenues. Name the file Copy_Read

b) Write a function that calculates the average revenue and the total revenue for each manager. The function should return the UIN of the manager and pass the Average revenue and Total Revenue for the manager as references.

c) Write a function that uses the function in b to create an array of average revenue and an array of total revenue for all managers. You can assume that the file may not have more than 100 rows.

d) Write a function that uses the function in b to write a file that is similar to the read file but at each row, the last two numbers are the average and Total Revenue. The new file should also have headers for all the columns and the columns should be aligned. You can assume that no first or last name is bigger than 15 characters. Name the file Revenues

e) Write a function that finds the two top managers in terms of total revenue and returns their UINs

f) Write a function that calculates the two bottom managers in terms of total revenue and returns their UINs

g) Write a function that calculates the Total Revenue for all managers.

h) Write a function that prints a report in a file. Name the file Final_Report.

The report should include:

  1. The total Revenue for all managers.
  2. The total number of customers.
  3. The Names along with the average and total revenue and number of customers for the two top managers.
  4. The names along with the average and total revenue and number of customers for the lagging two bottom managers.

For this program you can use either arrays or structures.

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

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

Students also viewed these Databases questions