Question
(use python)Write a function called TotalTuitions that receives one parameter and it returns back one value . The function's parameter represents a number of students
(use python)Write a function called TotalTuitions that receives one parameter and it returns back one value.
The function's parameter represents a number of students in a university called Students Dream. Now you have to go over these students one by one (You need a loop) and do the following.
Ask the student to input his/her full name.
Ask the student to input the gender: M for male and F for female.
The student should then be asked to enter the total number of credits he or she is taking.
After that calculate and print the following.
Calculate the total amount of tuition plus the university fees that every student has to pay each semester.
The tuitions calculation depends on the status of the student (whether s/he is a full or a part-time student). Any student who is taking 12 or more credits is considered a full-time student; otherwise, the student is a part-time student.
A full-time student taking 12 to 20 credits (inclusively) pays a regular tuition of $14,000.00 per semester. A student taking more than 20 credits has to pay an extra $800.00 of tuition for each credit in excess of 20. On the other side, a part-time student pays a tuition of $900.00 per credit.
In addition to the tuitions, a student (whether full-time or part-time) must also pay university fees. The total of these fees is given by a flat amount of $100 plus $30.00 for each credit taken.
After you done doing all these calculations, let your function print the total student's balance (equals to the sum of the total tuition and fees) and print it.
Also, the function has to store all the total students' balances and returns that at the end of the function.
Think how you want to do that inside the loop and how you are going to return that at the end of the function.
Invoke/test/call this function inside the main function. Make sure to prepare the argument needed for this function before calling it by asking the user for the number of students in the main function and then call the function. Also, make sure to print the result coming back from the function.
Sample Run:
Enter how many students: 3
Enter your full name: Ellen Soe Enter your gender (M for male and F for female): F Enter the total number of credits you are taking: 8
Ms. Soe: Your total tuition is: 7200 Your total fee is: 340 Your total balance is: 7540
Enter your full name: Salley Doe Enter your gender (M for male and F for female): F Enter the total number of credits you are taking: 16
Ms. Doe: Your total tuition is: 14000 Your total fee is: 580 Your total balance is: 14580
Enter your full name: John Hoe Enter your gender (M for male and F for female): M Enter the total number of credits you are taking: 23
Mr. Hoe: Your total tuition is: 16400 Your total fee is: 790 Your total balance is: 17190
The total of all the tuitions for all the students is: 39310
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started