Question

2 D Arrays & Vectors A company wants to be able to produce reports, for any...

2 D Arrays & Vectors

A company wants to be able to produce reports, for any year, of the annual profit for each of its three divisions, and for the company in total. The company tracks the sales of each division by quarter, but tracks the expenses on an annual basis only. Profit is calculated as: sales less expenses, less tax on sales less expenses.

Declare in main a 3 by 5 array for the company’s sales and expenses (three divisions, each with four quarters of sales and an annual expense).

Also, declare an empty vector for the three divisions' tax rates.

Have the user repeatedly enter a year for which reports are to be produced (unknown number of years), call the two functions described below and for the year entered, display the year and the company’s annual sales, annual expenses, and annual profit, and repeat until the user is finished.

The program will have two functions:

1) Have the user fill the sales and expenses array with quarterly sales for each division and its associated annual expenses. Validate that the entries are zero or greater. Also have the user store each division's tax rate in the vector.

2) Calculate and display each division’s annual sales, annual expenses, and profit (sales less expenses, minus tax on sales less expenses), and using reference variables accumulate and return to main the company’s annual sales, annual expenses and profit.

The tax rates for the three divisions are: 5.5%, 6.1%, and 4.8% (same for all years).

Provide screen prints for 2 years with the following data:

2012

division #1/sales: $25,000; $23,000; $28,000; $27,500/expenses: $81, 250

division #2/sales: $15,000; $13,500; $20,000; $17,250/expenses: $71, 050

division #3/sales: $29,000; $33,000; $38,000; $25,500/expenses: $100, 100

2015

division #1/sales: $25,100; $23,000; $25,000; $26,500/expenses: $91, 250

division #2/sales: $12,000; $11,500; $20,000; $13,250/expenses: $171, 050

division #3/sales: $28,000; $30,000; $39,000; $27,500/expenses: $130, 100

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
_________________

#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;

void getData(int &year,double sales[3][5]);
double calculateTax(double sales[3][5],vector<double> taxRate);
void display(double sales[3][5],int year);
int main()
{

double sales[3][5];
vector<double> taxRate;
int year;
double profit;

taxRate.push_back(5.5);
taxRate.push_back(6.1);
taxRate.push_back(4.8);

getData(year,sales);
profit=calculateTax(sales,taxRate);

display(sales,year);
cout<<"Total Profit:$"<<profit<<endl;
return 0;
}
void getData(int &year,double sales[3][5])
{
cout<<"Enter Year :";
cin>>year;
for(int i=0;i<3;i++)
{
    cout<<"Division#"<<i+1<<":"<<endl;
    for(int j=0;j<4;j++)
    {
cout<<"Enter Sales in Quarter#"<<i+1<<":$";
cin>>sales[i][j];
   }
   cout<<"Enter Expences :$";
   cin>>sales[i][4];
}  
}   
double calculateTax(double sales[3][5],vector<double> taxRate)
{
   double profit[3],sum=0,totProfit=0;
   for(int i=0;i<3;i++)
   {
       for(int j=0;j<4;j++)
       {
           sum+=sales[i][j];
       }
       sum-=sales[0][4];
       profit[i]=sum-(sum*(taxRate[i]/100));
   }
   for(int i=0;i<3;i++)
   {
       totProfit+=profit[i];
   }
   return totProfit;
}
void display(double sales[3][5],int year)
{
   cout<<"\n"<<year<<endl;
   for(int i=0;i<3;i++)
   {
       cout<<"division #"<<i+1<<"/";
       for(int j=0;j<4;j++)
       {
           cout<<"sales: $"<<sales[i][j]<<";";
       }
       cout<<"/expenses: $"<<sales[i][4]<<endl;
   }
}

____________________________

Output:


_______________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
2 D Arrays & Vectors A company wants to be able to produce reports, for any...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ Programming- CIS 1111 The CPlusPlus & LandMinusMinus Company needs you to write a program which...

    C++ Programming- CIS 1111 The CPlusPlus & LandMinusMinus Company needs you to write a program which will produce a report, in both number and chart form, which will display Net Sales for their three company divisions, for any given month of the year entered by the user. The corporate tax rate for the company is 30% (define as constant); the three division names are East-Coast, Mid-West, and West-Coast. Requirements Have the user enter a month name, and then process each...

  • CASE STUDY 16.1 Accent Oak Furniture Company Accent Oak Furniture Company has been in business for...

    CASE STUDY 16.1 Accent Oak Furniture Company Accent Oak Furniture Company has been in business for more than 30 years, serving custom ers in Chicago and the surrounding area. The business consists of three different divisions: a custom furniture division that manufactures such crafted items as dining room suites, a kitchen cabinet division, and a banister division that manufactures and installs quality oak railings. Each division reports to a vice president who in turn reports to Frank Johnson, the president...

  • “I know headquarters wants us to add on that new product line,” said Dell Havasi, manager of Billings Company’s offi...

    “I know headquarters wants us to add on that new product line,” said Dell Havasi, manager of Billings Company’s office products division. “But I want to see the numbers before I make any move. Our division has led the company for three years, and I don’t want any letdown.”         Billings Company is a decentralized organization with five autonomous divisions. The divisions are evaluated on the basis of the return that they are able to generate on invested assets, with...

  • Prepare a statement of cash flows using the direct method. FILMORE COMPANY Comparative Balance Sheets December...

    Prepare a statement of cash flows using the direct method. FILMORE COMPANY Comparative Balance Sheets December 31 2013 2014 25,000 41,000 Assets 33,000 14,000 25,000 Cash Accounts receivable Inventory Property, plant, and equipment 73,000 Less: Accumulated depreciation 27,000) Total 23,000 45.000$126,000 78,000 46.000 (24,000) 54,000 135,000 Liabilities and Stockholders' Equity Accounts payable Income taxes payable Bonds payable Common stock Retained earnings Total $23,000 26,000 20,000 25,000 41,000 $135,000 $ 46,000 23,000 10,000 25,000 22,000 $126,000 FILMORE COMPANY Income Statement For...

  • Consider the following scenario: Cute Camel Woodcraft Company’s income statement reports data for its first year...

    Consider the following scenario: Cute Camel Woodcraft Company’s income statement reports data for its first year of operation. The firm’s CEO would like sales to increase by 25% next year. 1. Cute Camel is able to achieve this level of increased sales, but its interest costs increase from 10% to 15% of earnings before interest and taxes (EBIT). 2. The company’s operating costs (excluding depreciation and amortization) remain at 70.00% of net sales, and its depreciation and amortization expenses remain...

  • Problem 9-18A Return on Investment (ROI) and Residual Income [LO9-1, LO9-2] “I know headquarters wants us...

    Problem 9-18A Return on Investment (ROI) and Residual Income [LO9-1, LO9-2] “I know headquarters wants us to add that new product line,” said Dell Havasi, manager of Billings Company’s Office Products Division. “But I want to see the numbers before I make any move. Our division’s return on investment (ROI) has led the company for three years, and I don’t want any letdown.”      Billings Company is a decentralized wholesaler with five autonomous divisions. The divisions are evaluated on the basis...

  • 3. Financial statements and reports Aa Aa E The income statement, also known as the profit...

    3. Financial statements and reports Aa Aa E The income statement, also known as the profit and loss (P&L) statement, provides a snapshot of the financial performance of a company during a specified period of time. It reports a firm's gross income, expenses, net income, and the income that is available for distribution to its preferred and common shareholders. The income statement is prepared using the generally accepted accounting principles (GAAP) that match the firm's revenues and expenses to the...

  • Please give us the process and reasons for solving the problem 1. A company reports the...

    Please give us the process and reasons for solving the problem 1. A company reports the following amounts at the end of the current year: Sales revenue $860,000 Selling expenses 250,000 Gain on the sale of land 30,000 Interest expense 10,000 Cost of goods sold 520,000 Under normal circumstances (ignoring tax effects), permanent earnings would be computed as ______. A. $90,000 B. $110,000 C. $80,000 D. $50,000 2. On August 1, 2022, Rocket Retailers adopted a plan to discontinue its...

  • Problem 11-18 Return on Investment (ROI) and Residual Income [LO11-1, LO11-2] “I know headquarters wants us...

    Problem 11-18 Return on Investment (ROI) and Residual Income [LO11-1, LO11-2] “I know headquarters wants us to add that new product line,” said Dell Havasi, manager of Billings Company’s Office Products Division. “But I want to see the numbers before I make any move. Our division’s return on investment (ROI) has led the company for three years, and I don’t want any letdown.”      Billings Company is a decentralized wholesaler with five autonomous divisions. The divisions are evaluated on the basis...

  • Problem 10-18 Return on Investment (ROI) and Residual Income [LO10-1, LO10-2] “I know headquarters wants us...

    Problem 10-18 Return on Investment (ROI) and Residual Income [LO10-1, LO10-2] “I know headquarters wants us to add that new product line,” said Dell Havasi, manager of Billings Company’s Office Products Division. “But I want to see the numbers before I make any move. Our division’s return on investment (ROI) has led the company for three years, and I don’t want any letdown.” Billings Company is a decentralized wholesaler with five autonomous divisions. The divisions are evaluated on the basis...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT