Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ code needed I need this code in 3 seperate files. [ .cpp file for class , seperate header file (.h), and the seperate main.cpp

c++ code needed

I need this code in 3 seperate files. [ .cpp file for class , seperate header file (.h), and the seperate main.cpp (driver file) ]

Also Using Pointer Array in the class definition is a mandatory.

Output of the program should be how it is done in the image in the attachment below.

Make sure the following requirements are met.

A corporation has six divisions, each responsible for sales to different geographic locations.

Design a DivSales class that keeps sales data for a division with the following members:

An array or vector with four elements for holding four quarters of sales figures for the division.

A private static variable for holding the total corporate sales for all divisions for the entire year.

A member function that takes four arguments, each assumed to be the sales for a quarter. Example function declaration:

void enterSales(float quarter1, float quarter2, float quarter3, float quarter4);

The value of the four arguments should be copied into the array that holds the sales data.

The total of the four arguments should be added to the static variable that holds the total yearly corporate sales.

A function that takes an integer argument within the range of 0-3. The argument is to be used as a subscript for the division quarterly sales array.

The function should return the value of the array element with that subscript. Example function declaration:

float getQuarterlySales(int index);

Write a program that creates an array or vector of six DivSales objects. The program should ask the user to enter the sales for four quarters for each division.

After the the data is entered, the program should display a table showing the division sales for each quarter. The program should then display the total corporate sales for the year.

Input validation: Only accept non-negative values for quarterly sales figures.

image text in transcribed

Quarter 4 5000 Enter sales data for Division Quarter 1 870 Quarter 2: 3400 Quarter 3: 340 Quarter 4 4500 Enter sales data for Division 5 Quarter 1 450 Quarter 2: 200 Quarter 3 400 Quarter 4 900 Enter sales data for Division 6 Quarter 1 890 Quarter 2: 340 Quarter 3 230 Quarter 4 230 Sales for Division 1 Quarter 1: $4500.00 Quarter 2: $6500.00 Quarter 3: $7500.00 Quarter 4: $12000 . 00 Sales for Division 2 Quarter 1: $8700.00 Quarter 2: $4300.00 Quarter 3: $5500.00 Quarter 4: $10000.00 Sales for Division 3 Quarter 1: $6700.00 Quarter 2: $2300.00 Quarter 3: $1200.00 Quarter 4: $5000.00 Sales for Division Quarter 1: $870.00 Quarter 2: $3400.00 Quarter 3: $340.00 Quarter 4: $4500.00 Sales for Division 5 Quarter 1: $450.00 Quarter 2: $200.00 Quarter 3: $400.00 Quarter 4: $900.00 Sales for Division 6 Quarter 1: $890.00 Quarter 2: $340.00 Quarter 3: $230.00 Quarter 4: $230.00 Press Enter to Continue. Total Corporate Sales: $86950. 00

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

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

Describe the impact of the Charter of Rights and Freedon1s on HRM.

Answered: 1 week ago