Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are asked to write a program which enters three test 'scores plus their weighting factors. The program then calculates the weighted average. Based on

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
You are asked to write a program which enters three test 'scores plus their weighting factors. The program then calculates the weighted average. Based on that average it then determines the letter grade: A, B, C, D, or F. The standard grading scale of 90 s for an A, 80 s for a B, etc. Your program must have a main function and two additional functions that you create: calc_average and determine_grade. The main program inputs three test scores (floats) with each score in the range of 0 to 100. Also, input are three weighting factors which must be positive floating-point numbers not to exceed 3.0. Use while 1 . main to assure that all the test scores and weights are in the equired range. The loops will exit only when the scores and weights are in the range noted. Next main calls determine_grade which takes the weighted average returned by calc_average and uses selection structures to determine the letter grade (string data type). The main function then outputs the letter grade together with a message. If the grade is an A then "Congratulations" is printed. For a B the message is "Good Job" and for a C the message is "Average work". For a D the print "You may need to repeat the course." Lastly print for an F, "Sorry, failure - repeat the course." Csees to be Run: test scores =90,85,95 weights =1,1,2 test scores =60,70,80 weights =1,2,3 test scores =40,50,10 veights =2,1,1 Compute the weighted averages using a calculator and determine the letter grade. Compare with your program output - they must be the same. Starter Code: 4 Header Comments (file, date, lab, name, etc. as before) defmain0: input test1, test2, test 3 input weight1, weight 2 , weight 3 while loops validate input (see lab description for range) 1 call calc_average: average = calc_average (test1, test 2 , test 3 , weight 1 , weight 2 , weight 3 ) - call determine_grade: grade = determine_grade (average) 4 print results and output descriptive message (see lab description) def calc average (t1,t2,t3,w1,w2,w3) : mutiply t values by w values and add. divide by sum of w values. Assign to ave and return return (ave) def determine grade (wtave): $ check the wtage value to 1 imits on A,B,C,D,F ranges 4 using selection structures and return the letter grade (1trgde) return (1trgde) main( ) must include in order to program to execute Output for three cases goes here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

How will these issues affect the grade levels you will teach?

Answered: 1 week ago