197k views
1 vote
Your manager has asked you to write a program that displays the percentage of males and female in your class. The program should prompt the user to enter the number of males and females and display the results.

1 Answer

2 votes

Step-by-step explanation:

The program using python programming language would be:

First, we write the Input prompt.

Input prompt for the user

number_of_males_in_class = int (input ('Enter the number of males: '))

number_of_females_in_class = int(input('Enter the number of females: '))

Next, we write the Process algorithm.

Process algorithm

total_number_of_students_in_class = number_of_females_in_class + number_of_males

_in_class

percentage_of_males_in_class = number_of_males_in_class / total_number_of_students

_in_class

percentage_of_females_in_class = number_of_females / total_number_of_students

Finally, the Output process

Output process

print('Total number of males in class =', format(percentage_of_males_in_class, '.0%'))

print('Total number of females =', format(percentage_of_females_in_class, '.0%'))

User Ajpolt
by
4.7k points