Retrieve quartsal.cpp from the Lab 7 folder. The code is as follows:// This program will read in the quarterly sales transactions for a given number// of years. It will print the year and transactions in a table format.// It will calculate year and quarter total transactions.// PLACE YOUR NAME HERE#include <iostream>#include <iomanip>using namespace std;const MAXYEAR = 10;const MAXCOL = 5;typedef int SalesType[MAXYEAR][MAXCOL]; // creates a new 2D integer data typevoid getSales(SalesType, int&); // places sales figures into the arrayvoid printSales(SalesType, int); // prints data as a tablevoid printTableHeading(); // prints table headingint main(){int yearsUsed; // holds the number of years usedSalesType sales; // 2D array holding// the sales transactionsgetSales(sales, yearsUsed); // calls getSales to put data in arrayLesson 7B 133printTableHeading(); // calls procedure to print the headingprintSales(sales, yearsUsed); // calls printSales to display tablereturn 0;}//*****************************************************************************// printTableHeading// task: This procedure prints the table heading// data in: none// data out: none////*****************************************************************************void printTableHeading(){cout << setw(30) << "YEARLY QUARTERLY SALES" << endl << endl << endl;cout << setw(10) << "YEAR" << setw(10) << "Quarter 1"<< setw(10) << "Quarter 2" << setw(10) << "Quarter 3"<< setw(10) << "Quarter 4" << endl;}//*****************************************************************************// getSales//// task: This procedure asks the user to input the number of years.// For each of those years it asks the user to input the year// (e.g. 2004), followed by the sales figures for each of the// 4 quarters of that year. That data is placed in a 2D array// data in: a 2D array of integers// data out: the total number of years////*****************************************************************************void getSales(SalesType table, int& numOfYears){cout << "Please input the number of years (1-" << MAXYEAR << ')' << endl;cin >> numOfYears;// Fill in the code to read and store the next valuecontinues134 LESSON SET 7 Arrays}//*****************************************************************************// printSales//// task: This procedure prints out the information in the array// data in: an array containing sales information// data out: none////*****************************************************************************void printSales(SalesType table, int numOfYears){// Fill in the code to print the table}Fill in the code for both getSales and printSales.This is similar to the price.cpp program in Exercise 1; however, thecode will be different. This is a table that contains something other thansales in column one.Exercise 7: Run the program so that the chart from Exercise 6 is printed.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 Retrieve quartsal.cpp from the Lab 7 folder. The code is as follows:
// This program will read in the quarterly sales transactions for a given number
// of years. It will print the year and transactions in a table format.
// It will calculate year and quarter total transactions.
// PLACE YOUR NAME HERE
#include <iostream>
#include <iomanip>
using namespace std;
const MAXYEAR = 10;
const MAXCOL = 5;
typedef int SalesType[MAXYEAR][MAXCOL]; // creates a new 2D integer data type
void getSales(SalesType, int&); // places sales figures into the array
void printSales(SalesType, int); // prints data as a table
void printTableHeading(); // prints table heading
int main()
{
int yearsUsed; // holds the number of years used
SalesType sales; // 2D array holding
// the sales transactions
getSales(sales, yearsUsed); // calls getSales to put data in array
Lesson 7B 133
printTableHeading(); // calls procedure to print the heading
printSales(sales, yearsUsed); // calls printSales to display table
return 0;
}
//*****************************************************************************
// printTableHeading
// task: This procedure prints the table heading
// data in: none
// data out: none
//
//*****************************************************************************
void printTableHeading()
{
cout << setw(30) << "YEARLY QUARTERLY SALES" << endl << endl << endl;
cout << setw(10) << "YEAR" << setw(10) << "Quarter 1"
<< setw(10) << "Quarter 2" << setw(10) << "Quarter 3"
<< setw(10) << "Quarter 4" << endl;
}
//*****************************************************************************
// getSales
//
// task: This procedure asks the user to input the number of years.
// For each of those years it asks the user to input the year
// (e.g. 2004), followed by the sales figures for each of the
// 4 quarters of that year. That data is placed in a 2D array
// data in: a 2D array of integers
// data out: the total number of years
//
//*****************************************************************************
void getSales(SalesType table, int& numOfYears)
{
cout << "Please input the number of years (1-" << MAXYEAR << ')' << endl;
cin >> numOfYears;
// Fill in the code to read and store the next value
continues
134 LESSON SET 7 Arrays
}
//*****************************************************************************
// printSales
//
// task: This procedure prints out the information in the array
// data in: an array containing sales information
// data out: none
//
//*****************************************************************************
void printSales(SalesType table, int numOfYears)
{
// Fill in the code to print the table
}
Fill in the code for both getSales and printSales.
This is similar to the price.cpp program in Exercise 1; however, the
code will be different. This is a table that contains something other than
sales in column one.
Exercise 7: Run the program so that the chart from Exercise 6 is printed.

AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education