Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

These are the two problems I'm working with in C++. I have the output problem solved and now I am attempting to read in the

These are the two problems I'm working with in C++. I have the output problem solved and now I am attempting to read in the file created from this first problem, and then calculate the data.

Corporate Sales Data Output

Write a program that uses a structure to store the following data on a company division:

Division Name (such as East, West, North, or South)

Quarter (1, 2, 3, or 4)

Quarterly Sales

The user should be asked for the four quarters sales figures for the East, West, North, and South divisions. The data for each quarter for each division should be written to a file.

Input Validation: Do not accept negative numbers for any sales figures.

Corporate Sales Data Input

Write a program that reads the data in the file created by the program in Programming Challenge 11. The program should calculate and display the following figures:

Total corporate sales for each quarter

Total yearly sales for each division

Total yearly corporate sales

Average quarterly sales for the divisions

The highest and lowest quarters for the corporation

-----------------------------------------------------------------------------

I have done the first problem, the Corporate Sales Data Output.

I am not sure how to read the file in from the output problem, and then perform the functions it asks for in the Input problem.

This is what I have for the Output problem:

cout<<"Corporate Sales Data Output"<> c.name; out << c.name << " "; for(int j = 0; j < 4; j++) { cout << "Enter the quarter number(1-4): "; cin >> c.quarter[i]; out << c.quarter[i] << " "; cout << "Enter quarter "<< j + 1 << " sales: "; cin >> c.sales[i]; if(c.sales[i] < 0) { cout<<"Enter only positive sales: "; cin>> c.sales[i]; } out << c.sales[i] << " "; if(j == 3) { out << "|"; } } } cout << "Sales data has been written to the file named " "corporateData.txt " << endl; } out.close();

-------------------------------------------------------------------------

------------------------------------------------------------------------

This is what I have for the input problem so far:

cout<<"Corporate Sales Data Input"<

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

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago