Question

create an application that allows the user to enter the gender (either F or M) and...

create an application that allows the user to enter the gender (either F or M) and GPA for any number of student the application should calculate the average GPA for all student, the average GPA for male students, and the average GPA for female students

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Thanks for the question. Below is an application in Python language. I developed it in Python as the programming language was not specifically mentioned, in case it needs to coded in a separate language please do comment and i will share the updated code.

Thank You !

===========================================================================

male_GPA = 0
male_GPA_count = 0

female_GPA = 0
female_GPA_Count = 0

repeat = 'yes'
while repeat == 'yes':
    gender = input('Enter Gender (F or M): ').upper()
    gpa_score = float(input('Enter GPA: '))
    if gender == 'M':
        male_GPA += gpa_score
        male_GPA_count += 1
    elif gender == 'F':
        female_GPA += gpa_score
        female_GPA_Count += 1
    repeat = input('Do you want to enter again( yes or no): ').lower()

total_gpa = male_GPA + female_GPA
total_count = male_GPA_count + female_GPA_Count
print('Average GPA of all students: {:.2f}'.format(total_gpa / total_count))

if male_GPA_count is not 0:
    print('Average GPA for male students: {:.2f}'.format(male_GPA / male_GPA_count))
if female_GPA_Count is not 0:
    print('Average GPA for female students: {:.2f}'.format(female_GPA / female_GPA_Count))

=================================================================

Screenshot of the code and output

Add a comment
Know the answer?
Add Answer to:
create an application that allows the user to enter the gender (either F or M) and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PYTHON*************** Create a Person Class that: Accepts First Name, Last Name, Age, and Gender Has a...

    PYTHON*************** Create a Person Class that: Accepts First Name, Last Name, Age, and Gender Has a method that adds all persons Validate all input, not left empty for First Name, Last Name, Gender and numeric for age and throw an exception if it does not validate within the class. Create a Student Class that: Inherits the Person Class Accepts GPA Validate GPA (>= 0 and <= 4.0) and throw exception if it does not validate within the class. Has methods...

  • Create an application that allows you to enter student data that consists of an ID number,...

    Create an application that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Depending on whether the student’s grade point average is at least 2.0, output each record either to a file of students in good standing (located at StudentsGoodStanding.txt) or those on academic probation (located at StudentsAcademicProbation.txt).

  • Create an application that allows you to enter student data that consists of an ID number,...

    Create an application that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Depending on whether the student’s grade point average is at least 2.0, output each record either to a file of students in good standing (located at StudentsGoodStanding.txt) or those on academic probation (located at StudentsAcademicProbation.txt). Enter ZZZ to Quit. This is in Java

  • This is C++ You will create an application that allows a user to enter the demographic...

    This is C++ You will create an application that allows a user to enter the demographic information: Name, address, phone number, and email address.

  • Create a java project and create Student class. This class should have the following attributes, name...

    Create a java project and create Student class. This class should have the following attributes, name : String age : int id : String gender : String gpa : double and toString() method that returns the Student's detail. Your project should contain a TestStudent class where you get the student's info from user , create student's objects and save them in an arralist. You should save at least 10 student objects in this arraylist using loop statement. Then iterate through...

  • c# language Description: Design and implement a C# application that allows the user to enter a...

    c# language Description: Design and implement a C# application that allows the user to enter a number N. It returns to the user the result of the Fibonacci of N. The Fibonacci of a number N is calculated as follows: Fibonacci (0) 0 Fibonacci (1) - Fibonacci (n) - Fibonacci (n-1) + Fibonacci (n-2) Requirements Your Application should have the following: • An exception class called FibException that is thrown when the user enters a negative value of N •...

  • need to be solved including (using namespace std) and without using arrays Problem: Write a CH...

    need to be solved including (using namespace std) and without using arrays Problem: Write a CH program that considers many students (the number of students is given as an input to the program by the user). For each student the program allows the user to input the ID of the student (as integer number), the student gender (one character M for male and F for female), and grades of 2 tests (a Test grade is a value between 0 and...

  • IN PYTHON ONLY I am looking for 4 columns, Age, Gender, Ideal Age of a Spouse,...

    IN PYTHON ONLY I am looking for 4 columns, Age, Gender, Ideal Age of a Spouse, and the message. I will have 6 rows in the table, and 4 columns, followed by  averages. Calculate the ideal age of a spouse. Enter either m or f from the keyboard in lower case. You may use string data for the gender. Convert the gender to upper case Enter an age from the keyboard, probably an integer You will need prompts telling the user...

  • chapter 7. Create a program that allows the user to enter the ages (in years) of...

    chapter 7. Create a program that allows the user to enter the ages (in years) of five people. The program should display the average age. Use the for the statement. Display the average age with one decimal place. If necessary, create a new project named TryThis15 Project, and save it in the Cpp8\Chap07 folder. Enter the C++ instructions into a source file named TryThis15.cpp. Also, enter appropriate comments and any additional instructions required by the compiler. Test the program using...

  • Write a program that allows the user to enter a series of exam scores. The number...

    Write a program that allows the user to enter a series of exam scores. The number of scores the user can enter is not fixed; they can enter any number of scores they want. The exam scores can be either integers or floats. Then, once the user has entered all the scores they want, your program will calculate and print the average of those scores. After printing the average, the program should terminate. You need to use a while loop...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT