100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4,6 TrustPilot
logo-home
Other

COS1511 ASSIGNMENT4 2021 MEMO

Rating
-
Sold
-
Pages
13
Uploaded on
26-08-2021
Written in
2021/2022

COS1511 ASSIGNMENT4 2021 MEMO










Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
August 26, 2021
Number of pages
13
Written in
2021/2022
Type
Other
Person
Unknown

Subjects

Content preview

8.9 Assignment 4


SUBMISSION: Electronically via myUnisa
Please note that we automatically give four days extension for this aassignment. It will be
to your own advantage to check after a few days whether the assignment has been registered
on the system. If you have not completed the assignment by the extension date, submit
whatever you have completed – you will get marks for everything that you have done.
If myUnisa is off-line when you want to submit the assignment, you need not contact us, because
we will be aware of it. Simply submit it as soon as myUnisa is available again.

DUE DATE 04 October 2021

UNIQUE NUMBER 862799

EXTENSION There is NO extension for this assignment.

TUTORIAL MATTER Study Guide, Lessons 24 –

CONTRIBUTION WEIGHT TO 20%
SEMESTER MARK



[85 Marks]


QUESTION 1: WHILE LOOP and SWITCH
An events ticket booking System prompts the user to make a choice as well as the number of tickets required. It
then displays the total cost of the order. The menu options and cost per ticket is as follows:

1 Exclusive VIP area A : R3 000.00
2 VIP area B : R2 000.00
3 Elevated area :R1200.00
4 General area R600.
0 QUIT


QUESTION 1a
A valid selection must be between 0 and 4. Enter the program below and complete the while loop. Name the
program question1.cpp, compile and run it.

#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
// Fill in the code to define an integer variable called selection

cout << "Please enter the choice of ticket "
<< "(a number from 1 to 4 or 0 to quit) " << endl;
cout << "Ticket Menu " << endl << endl;
cout << "1: Exclusive VIP area A " << endl;
52

, Question 1 a and b
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int selection;

cout << "Please enter the choice of ticket "
<< "(a number from 1 to 4 or 0 to quit) " << endl;
cout << "Ticket Menu " << endl << endl;
cout << "1: Exclusive VIP area A " << endl;
cout << "2: VIP area B " << endl;
cout << "3: Elevated area " << endl;
cout << "4: General area R600 " << endl;
cout << "0: QUIT " << endl << endl << endl;
cin >> selection;

while (selection<0 || selection > 4)
{
cout << "Invalid choice – Please re - enter ";
cin >> selection;
}
cout << "You have selected option number " << selection;

cout << "How many tickets would you like?" << endl;

int cost = 0;
int number;
cout << " Enter the number of tickets required ";
cin >> number;

switch (selection)
{
case 1: cost = number * 3000;
cout << "The total cost is R " << cost << endl;
break;

case 2: cost = number * 2000;
cout << "The total cost is R " << cost << endl;
break;
case 3: cost = number * 1200;
cout << "The total cost is R " << cost << endl;
break;
case 4: cost = number * 600;
cout << "The total cost is R " << cost << endl;
break;
case 0: cout << " Please come again" << endl;
break;
default:
cout << "Invalid selection";
cout << " Try again please" << endl;
}

system("Pause");
return 0;
}
R259,00
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
ExcellingStudent

Document also available in package deal

Thumbnail
Package deal
COS1511 ASSIGNMENT 3 & 4 2021 MEMO(s)
-
2 2021
R 518,00 More info

Get to know the seller

Seller avatar
ExcellingStudent University of South Africa (Unisa)
View profile
Follow You need to be logged in order to follow users or courses
Sold
2
Member since
4 year
Number of followers
2
Documents
4
Last sold
4 year ago

0,0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions