Parents of the pupils of the Park Primary School must
pay an amount for outfits for the annual play. All
pupils take part in the play, except the Grade 0 pupils. The amount
that the parents have to pay is
calculated as follows:
• The cost of the outfits for Grade 1 and 2 pupils is R45
• The cost of the outfits for Grades 3 to 5 is R65
• Grade 6 and 7 pupils may play one or two roles. If they play a
leadrole, they may only play one role.
The cost of the outfits is R70 if they play one role. If
this role is a leadrole, the cost is R100. If they play two
roles, the cost is R130
Use a switchstatement and write down ONLY the necessary C++
statements to calculate and display
the amount to be paid or display an appropriate error message if
required.
Do NOT write a complete program. Use the following variables:
int grade;
int fee;
bool leadrole; // true if a child plays a leadrole
bool roles2; // true if a child plays 2 roles
Assume that values have been assigned to these variables
already.
#include<iostream>
using namespace std;
int main()
{
int grade ;
int fee;
bool leadrole ; // true if a child plays a
leadrole
bool roles2 ; // true if a child plays 2 roles
switch (grade)
{
case 0:
fee = 0;
break;
case 1:
case 2:
fee
= 45;
break;
case 3:
case 4:
case 5:
fee = 65;
break;
case 6:
case 7:
{
if(leadrole && !roles2)
{
fee =
100;
}
else if(!leadrole &&
roles2)
{
fee =
130;
}
else if(!leadrole &&
!roles2 )
{
fee =
70;
}
else
{
cout<<"Cannot Play 2 roles, with one being lead
role!!\n";
fee=-1;
}
}
break;
default:
cout<<"Not
a valid Grade!!";
fee = -1;
}
if(fee>=0)
{
cout<<"fees =
"<<fee;
}
}
Parents of the pupils of the Park Primary School must pay an amount for outfits for...
Parents of the pupils of the Park Primary School must pay an amount for outfits for the annual play. All pupils take part in the play, except the Grade O pupils. The amount that the parents have to pay is calculated as follows: The cost of the outfits for Grade 1 and 2 pupils is R45 The cost of the outfits for Grades 3 to 5 is R65 Grade 6 and 7 pupils may play one or two roles. If...
Parents of the pupils of the Park Primary School must pay an amount for outfits for the annual play. All pupils take part in the play, except the Grade 0 pupils. The amount that the parents have to pay is calculated as follows: The cost of the outfits for Grade 1 and 2 pupils is R45 The cost of the outfits for Grades 3 to 5 is R65 Grade 6 and 7 pupils may play one or two roles. If...
Parents of the pupils of the Park Primary School must pay an amount for outfits for the annual play. All pupils take part in the play, except the Grade 0 pupils. The amount that the parents have to pay is calculated as follows: • The cost of the outfits for Grade 1 and 2 pupils is R45 • The cost of the outfits for Grades 3 to 5 is R65 • Grade 6 and 7 pupils may play one or...
QUESTION 1 12 marks Parents of the pupils of the Park Primary School must pay an amount for outfits for the annual play. All pupils take part in the play, except the Grade O pupils. The amount that the parents have to pay is calculated as follows: The cost of the outfits for Grade 1 and 2 pupils is R45 The cost of the outfits for Grades 3 to 5 is R65 Grade 6 and 7 pupils may play one...
Parents of the pupils of the Park Primary School must pay an amount for outfits for the annual play. All pupils take part in the play, except the Grade 0 pupils. The amount that the parents have to pay is calculated as follows: The cost of the outfits for Grade 1 and 2 pupils is R45 The cost of the outfits for Grades 3 to 5 is R65 Grade 6 and 7 pupils may play one or two roles. If...
QUESTION 2 [12] Parents of the pupils of the Park Primary School must pay an amount for outfits for the annual play. All pupils take part in the play, except the Grade 0 pupils. The amount that the parents have to pay is calculated as follows: . The cost of the outfits for Grade 1 and 2 pupils is R45. The cost of the outfits for Grades 3 to 5 is R65. Grade 6 and 7 pupils may play one...
SECTION B 80 MARKS QUESTION 1 12 marks Parents of the pupils of the Park Primary School must pay an amount for outfits for the annual play. All pupils take part in the play, except the Grade O pupils. The amount that the parents have to pay is calculated as follows: The cost of the outfits for Grade 1 and 2 pupils is R45 The cost of the outfits for Grades 3 to 5 is R65 Grade 6 and 7...
SECTION B 80 MARKS QUESTION 1 12 marks Parents of the pupils of the Park Primary School must pay an amount for outfits for the annual play. All pupils take part in the play, except the Grade 0 pupils. The amount that the parents have to pay is calculated as follows: The cost of the outfits for Grade 1 and 2 pupils is R45 The cost of the outfits for Grades 3 to 5 is R65 Grade 6 and 7...
SECTION B 80 MARKS QUESTION 1 12 marks Parents of the pupils of the Park Primary School must pay an amount for outfits for the annual play. All pupils take part in the play, except the Grade 0 pupils. The amount that the parents have to pay is calculated as follows: The cost of the outfits for Grade 1 and 2 pupils is R45 The cost of the outfits for Grades 3 to 5 is R65 Grade 6 and 7...