You are on page 1of 5

INSTRUCTORS: MR. HALZEN G. ASHTON SMITH (M.SC.) & MR.

KERON
TOOMA (M.SC.)
TUTOR: KEVIN K. KENNEDY
COURSE: INTRODUCTION TO PROGRAMMING

Revision and Conclusion


(Tutorial # 10)

TUTOR: KEV IN K. KEN NED Y


INST RUCT ORS: MR. HALZE N G. ASHTON SMIT H ( M.S C.) & MR. KE RO N TOOMA (M.SC.)

Revision and Conclusion (Final Tutorial)


The aim of weekly tutorials was to aid in the reinforcement of various concepts that
were taught in your respective lecture sessions. To this extent our final and
concluding tutorial is aimed at integrating most of the concepts that were taught
throughout the semester, to create a C++ console application utilising most of the
programming principles and techniques that you have learnt . Please note that the
question might not be completed within our final tutorial session, but the
responsibility is yours to complete it for your own betterment.

MAIN QUESTION
Develop a C++ console application that stimulates the idea of POS System that allows a user to
calculate the total bill of five products for each sale.
First declare the following global variables initialised to the respective values:
double maxSaleTotal = 0.0;
double minSaleTotal = 99999999999999999999999999999999999999999999999.9;
string maxCashier = ;
string minCashier = ;
Secondly, with the aid of a function called menu () display the following main menu and
consequently accept the numerical option from the user. The menu() function should return the

1|Page

TUTOR: KEV IN K. KEN NED Y


INST RUCT ORS: MR. HALZE N G. ASHTON SMIT H ( M.S C.) & MR. KE RO N TOOMA (M.SC.)

accept numerical value to a switch structure within the main() function.

Thirdly, utilise a function named makeSale() that is invoked whenever the user enters 1, that
allows the user to enter the price for five products in each sale transaction. The price for each
product is as follows: Product 1 - 1.5, Product 2 - 1.0, Product 3 - 2.0, Product 4 - 2.5, and
Product 5 - 1.5. Consequently display the total sale bill, as well as ask the user to enter their
name. Use the global variables to keep track of the maximum and minimum total bill, as well as
the cahier who made the transaction for the respective maximum and minimum total bill. After
the user has entered their name invoke bargraph() function that accepts an array with the subtotal
for each product, as well as the size of the array. The bargraph() function should display a
horizontal asterisks bar graph dependent on the respective sub totals. Allow the user to continue
making sale transactions by entering Y otherwise ask the user to enter N if they do not wish to
make another sale transaction. An illustration of the above mentioned instruction is shown below.

2|Page

TUTOR: KEV IN K. KEN NED Y


INST RUCT ORS: MR. HALZE N G. ASHTON SMIT H ( M.S C.) & MR. KE RO N TOOMA (M.SC.)

Fourthly, utilise a function named viewItems() that is invoked whenever the user enters 2, this
function shoud display the screen as shown below:

Fifthly, utilise a function named maxSale() that is invoked whenever the user enters 3, this
function should display the screen as shown below with the utilisation of the respective global
variables that was used to store the name of the cashier whom made the maximum total bill, as
well as the maximum total bill itself.

3|Page

TUTOR: KEV IN K. KEN NED Y


INST RUCT ORS: MR. HALZE N G. ASHTON SMIT H ( M.S C.) & MR. KE RO N TOOMA (M.SC.)

Sixthly, utilise a function named minSale() that is invoked whenever the user enters 4, this
function should display the screen as shown below with the utilisation of the respective global
variables that was used to store the name of the cashier whom made the minimum total bill, as
well the minimum total bill itself.

Seventhly when user enters 5, utilise the exit() function to terminate the program.
Finally, have fun and God bless.

4|Page

You might also like