The following table shows the latest fees Al Ummah Islamic School.
First Child = RM 500
Second Child Onwards RM 450
a) Function calcFees () will receive the number of children and will calculate and return the fee.
b) Function calcDisc () will receive the fee and return the totalFee. If the users want to pay yearly, they will get a 10 % discount.
c) Function main () will prompt the users to input the number of children they wish to enroll in the school and whether the user want to pay yearly. Then, it will call function calcFees () and calcDisc(). The program will then display the following receipt.
******* AL UMMAH ISLAMIC SCHOOL ****************
NUMBER OF CHILDREN : 3 TOTAL
MONTHLY FEE : RM 1400
TOTAL YEARLY FEE : RM 16800
TOTAL YEARLY FEE (DISCOUNT) : RM 15120
THANK YOU FOR BEING PART OF AL UMMAH ISLAMIC SCHOOL!
#include <iostream>
double calcFees(int childs) {
if (childs == 1)
return 500;
else
return 500 + 450 * (child - 1);
}
double calcTotalFees(int childs) {
return 12 * calcFees(childs);
}
double calcDisc(int childs) {
return 0.9 * calcTotalFees(childs);
}
int main()
{
int childs;
std::cin >> childs;
std::cout << "******* AL UMMAH ISLAMIC SCHOOL ****************" << std::endl;
std::cout << "NUMBER OF CHILDREN : " << childs << " TOTAL" << std::endl;
std::cout << "MONTHLY FEE : RM " << calcFees(childs) << std::endl;
std::cout << "TOTAL YEARLY FEE : RM " << calcTotalFees(childs) << std::endl;
std::cout << "TOTAL YEARLY FEE (DISCOUNT) : RM " << calcDisc(childs) << std::endl;
std::cout << "THANK YOU FOR BEING PART OF AL UMMAH ISLAMIC SCHOOL!" << std::endl;
return 0;
}
Comments
Leave a comment