Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 6 : ( Optional ) Look at the following table that contains quarterly sales transactions for three years of a small company. Each of
Exercise : 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 Quarter Quarter Quarter
We could use a twodimensional array consisting of rows and columns.
Even though there are only four quarters we need columns the first
column holds the year
Retrieve quartsal.cpp from the Lab 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 ;
const MAXCOL ;
typedef int SalesTypeMAXYEARMAXCOL; creates a new D integer data type
void getSalesSalesType int&; places sales figures into the array
void printSalesSalesType int; prints data as a table
void printTableHeading; prints table heading
int main
int yearsUsed; holds the number of years used
SalesType sales; D array holding
the sales transactions
getSalessales yearsUsed; calls getSales to put data in array
Lesson B
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started