The program for calculating the amount to be paid by the students is given below-
The necessary C++ statements are-
int amount = 0;
switch(grade)
{
case 1:
case 2:
amount = 45;
break;
case 3:
case 4:
case 5:
amount = 65;
break;
case 6:
case 7:
if(roles2 == false)//Single role is played
{
if(leadrole)//If single role is leadrole
amount = 100;
else
amount = 70;
}
else //For 2 roles
amount = 130;
break;
default:
cout << "Wrong grade is chosen.";
}
cout << "Amount to be paid: " << amount;
The complete program if you want is-
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
//As given in the question, these values are already present. Else input it by cin.
int grade;
int fee;
bool leadrole;
bool roles2;
int amount = 0;
switch(grade)
{
case 1:
case 2:
amount = 45;
break;
case 3:
case 4:
case 5:
amount = 65;
break;
case 6:
case 7:
if(roles2 == false)//Single role is played
{
if(leadrole)//If single role is leadrole
amount = 100;
else
amount = 70;
}
else //For 2 roles
amount = 130;
break;
default:
cout << "Wrong grade is chosen.";
}
cout << "Amount to be paid: " << amount;
return 0;
}
Code Screenshot -
Run the code -
OUTPUT -
If I manually set the values, grade=6,leadrole=false,roles2=true, then the output will be-
QUESTION 2 [12] Parents of the pupils of the Park Primary School must pay an amount...
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...
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...
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...
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...
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...