Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please, using C, not C+ or C++. Thanks Files to submit: grade_need.c Time it took Matthew to Complete: 15 mins Requriements Program must compile with

Please, using C, not C+ or C++. Thanks

Files to submit: grade_need.c

Time it took Matthew to Complete: 15 mins

Requriements

Program must compile with both -Wall and -Werror options enabled

Submit only the files requested

Use doubles to store real numbers

Print all doubles to 2 decimal points unless stated otherwise

Restrictions

No global variables may be used

Your main function may only declare variables and call other functions

Description

Write a program called grade_need.c that calcualtes the minimum percent needed on the final to achieve the desired grade. If the desired grade cannot be achieved because the person cannot score low or high enough on the final to get the desired grade, your program should tell them so.

Grade Minimum Percent Needed
A 90%
B 80%
C 70%
D 60%
F 0%

Requirements

Your program should be able to accept both lowercase and uppercase letters for the letter grade desired

Assumptions

Input is NOT guarenteed to be valid Some examples of improprer input are

Incorrectlly formatted input

Incorrect letter grades desired

If invalid input is received, your program should report it and terminate

You'll find the exit function in stdlib.h for doing this. Make sure to only use 0 with exit and no other value.

Wait until we cover how to handle invalid input in class before dealing with this part of the problem

Examples

Example 1

Enter the grade you want in the class: B Enter your current percent in the class: 75 Enter the weight of the final: 20 You need a grade of at least 100.00% on the final to get a B in the class.

Example 2

Enter the grade you want in the class: b Enter your current percent in the class: 75 Enter the weight of the final: 25 You need a grade of at least 95.00% on the final to get a b in the class.

Example 3

Enter the grade you want in the class: A Enter your current percent in the class: 85 Enter the weight of the final: 20 You cannot get a A in the class because you would need to score at least 110.00% on the final.

Example 4

Enter the grade you want in the class: F Enter your current percent in the class: 90 Enter the weight of the final: 10 You cannot score low enough on the final to get a F in the class.

Example 5

Enter the grade you want in the class: H Unknown Grade Received: H. Ending program.

Example 6

Enter the grade you want in the class: C Enter your current percent in the class: bob Invalid formatting. Ending program.

Example 7

Enter the grade you want in the class: A Enter your current percent in the class: 87 Enter the weight of the final: !75 Invalid formatting. Ending program.

Example 8

Enter the grade you want in the class: B Enter your current percent in the class: 12G Invalid formatting. Ending program.

Example 9

Enter the grade you want in the class: B Enter your current percent in the class: -35 The number you last entered should have been positive. Ending program.

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

Step: 3

blur-text-image

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions