100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

COS1511 Assignment 4 Semester 1 & 2 2021 Solutions [UPDATED]

Rating
-
Sold
11
Pages
14
Grade
A+
Uploaded on
17-09-2021
Written in
2021/2022

COS1511 Assignment 4 Semester 1 & 2 2021 with updated questions.

Institution
Course









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

Written for

Institution
Course

Document information

Uploaded on
September 17, 2021
Number of pages
14
Written in
2021/2022
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

My Assignments – Contact +27 68 202 1794


COS1511 ASSIGNMENT 4
2021 SEMESTER 1 & 2 [UPDATED QUESTIONS]


QUESTION 1
(a)
#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;
return 0;

}




1|Page

, My Assignments – Contact +27 68 202 1794


(b)
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int selection;
int number;
float cost = 0;

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 << endl;
cout << "How many tickets would you like? ";
cin >> number;

switch(selection)
{
case 1:
cost = number*3000.00;
cout << "The total cost is R " << cost << endl;
break;
case 2:
cost = number*2000.00;
cout << "The total cost is R " << cost << endl;
break;
case 3:
cost = number*1200.00;
cout << "The total cost is R " << cost << endl;
break;
case 4:
cost = number*600.00;
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;
}

return 0;

2|Page

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
MyAssignments My Assignments
Follow You need to be logged in order to follow users or courses
Sold
171
Member since
4 year
Number of followers
144
Documents
38
Last sold
4 months ago
My Assignments

3.8

21 reviews

5
11
4
3
3
2
2
1
1
4

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 tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card 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