Design the logic in pseudocode for a family membership management program to be used at Sweaty Time Gym. Monthly membership fees are $30 per adult and $10 per child. When the family first signs up for membership, a one-time activation fee of $50 (for the entire family, not per person) is charged. The program must allow the user to enter the number of adults and number of children in the family, and output the totals for adults and children, and the total amount owed for the first month after including the activation fee. |
|
Instructions |
|
---|
Dear Learner,
Here is the pseudocode for the question
BEGIN:
1. Ask the user to enter the number of adults in their family and store the value in n_adults
n_adults .= read_input
2. Ask the user to enter the number of children in their family and store the value in n_child
n_child = read_input
3. Ask the user if they are registering for the first time
registering = read_input
4. if registering = true continue, else jump to step 6
5. total_fees = 30*n_adults + 10*n_child + 50, jump to 7
6. total_fees = 30*n_adults + 10*n_child
7. Display n_adults,n_child,total_fees
END
Here is a code in C for example
#include<stdio.h>
#include<conio.h>
main()
{
int n_adults,
n_child,total_fees,registering;
printf("Enter the number of adults:");
scanf("%d",&n_adults); //taking user input
for number of adults
printf("\nEnter the number of children");
scanf("%d",&n_child); //taking user input
for number of children
printf("\nRegistering for the first time? (1 for
yes |||| 0 for no)");
scanf("%d",®istering);
//asking f the user is registering for the first time
if(registering == 1)
{
total_fees = n_adults*30 +
n_child*10 + 50;
}
else
total_fees = n_adults*30 +
n_child*10;
//displaying the final results
printf("\nTotal number of adults = %d\nTotal
number of children = %d\nTotal Amount =
%d",n_adults,n_child,total_fees);
}
SAMPLE OUTPUT :
I hope I have explained the question the way you were expecting. If you still have any doubts or want any other explanation, feel free to ask us in the comment section.
Please leave a like if this was helpful.
Thanks,
Happy Studying.
Get Answers For Free
Most questions answered within 1 hours.