Question: Exercise 6 : ( Optional ) Look at the following table that contains quarterly sales transactions for three years of a small company. Each of

Exercise 6: (Optional) Look at the following table that contains quarterly sales
transactions for three years of a small company. Each of the quarterly
transactions are integers (number of sales) and the year is also an integer.
YEAR Quarter 1 Quarter 2 Quarter 3 Quarter 4
2000728060100
200182904398
200264785884
We could use a two-dimensional array consisting of 3 rows and 5 columns.
Even though there are only four quarters we need 5 columns (the first
column holds the year).
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
#include
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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!