Question
For C++ Write an if else statement to convert a letter grade into an equivalent numeric value on a four-point scale. Set the value of
For C++
Write an if else statement to convert a letter grade into an equivalent numeric value on a four-point scale. Set the value of the variable gradeValue to 4.0 for an A or a, 3.0 for a B or b, 2.0 for a C or c, 1.0 for a D or d, and 0.0 for an F or f. For any other letter, set the grade value to 0.0 and display an error message.
Note:
If the user enters b instead of B. It should display the same result. Value will not change with the case. Make sure to put an error message for non acceptable grade.
In your code, Every grade should have only one cout statement, 6 cout statements. It doesn't include input statement and thankyou statement.
Feel free to write as many cout statement as you want for introduction of the program and for input the letter.
Failure to meet this requirement will result in half the credit (2.5).
Letter in red is entered by the user.
Sample Output-1: Please enter your grade, I will tell your grade value: B Your grade value is: 3.0 Sample Output-2: Please enter your grade, I will tell your grade value: a Your grade value is: 4.0 Sample Output-3: Please enter your grade, I will tell your grade value: F Your grade value is: 0.0 Sample Output-4: Please enter your grade, I will tell your grade value: R Your grade value is: 0.0 It's an invalid grade!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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