Home /
Expert Answers /
Computer Science /
question-1-on-the-given-table-and-flowchart-below-your-program-must-implement-two-user-defined-fu-pa676
(Solved): QUESTION 1 on the given table and flowchart below. Your program must implement two user-defined fu ...
QUESTION 1 on the given table and flowchart below. Your program must implement two user-defined functions that Using selection control structure "if..else", write a program to calculate and display the total rate based return the TotalRate for age below 20 and age above 20. The function headers are shown below: i. ii. float calcBelow20 (int totalGame, char members); float calcAbove20 (int totalGame, char members); OK Bowling Centre giving a special rate for their customer as shown in Table 1 below: Table 1: Table for rate per game. Members Rate per game Age below 20 Age 20 & above Non members RM7.00 per game RM5.50 per game RM8.50 per game RM11.00 per game Main Function Flowchart: Start Read age, members, totalGames age 20 Display TotalRate End No TotalRate- cale Below 20 Yes TotalRate- calcAbove20
calcBelow 20 Function Flowchart: Start Yes No members? TotalRate= totalGames x 5.50 TotalRate- totalGames x 7.00 calcAbove 20 Function Flowchart: Start Yes No members? TotalRate totalGames x8.50 TotalRate totalGames x 11.00 Figure 1: Flowchart for total rates. Welcome to OK Bowling Center!! This program will display your total rates Enter your age: 29 [Enter] With OK Bowling membership? (Y/N): Y [Enter] Total game: 3 [Enter] Your total rate is RM25.50 Figure 2: Expected output. OUTPUT CONSOLE Return TotalRate Return TotalRate ADE X
QUESTION 1 on the given table and flowchart below. Your program must implement two user-defined functions that Using selection control structure "if..else", write a program to calculate and display the total rate based return the TotalRate for age below 20 and age above 20. The function headers are shown below; i. float calcBelow20 (int totalGame, char members); float calcAbove20 (int totalGame, char members); ii. OK Bowling Centre giving a special rate for their customer as shown in Table 1 below: Table 1: Table for rate per game. Members Rate per game Age below 20 Age 20 & above Non members RM7.00 per game RM5.50 per game RM8.50 per game RM11.00 per game Main Function Flowchart: Start Read age, members, totalGames age >=20 Display TotalRate End No TotalRate- calcBelow 201 Yes TotalRate- calcAbove20
calcBelow20 Function Flowchart: Start Yes No members? TotalRate= totalGames x 5.50 TotalRate = totalGames x 7.00 calcAbove20 Function Flowchart: Start Yes No members? TotalRate- totalGames x8.50 TotalRate totalGames x 11.00 Figure 1: Flowchart for total rates. Welcome to OK Bowling Center!! This program will display your total rates Enter your age: 29 [Enter] With OK Bowling membership? (Y/N): Y [Enter] Total game: 3 [Enter] Your total rate is RM25.50 Figure 2: Expected output. OUTPUT CONSOLE Retum. TotalRate Return TotalRate 1 X
Ans-) Code:- #include #include using namespace std; //function to return total rate for the age below 20 float calcBelow20(int totalGame, char member){ //if the user is member then return total rate with unit rate of 5.50