Calculate Degree Write a program i
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 20PE
Related questions
Question
Calculate Degree
Write a program in which you define the function called calculate_degree. This function must receive a float number between 0 and 1, and must return an alphabetical note according to the following table.
score
Note
> 0.9
TO
> 0.8
B.
>0.7
C
> 0.6
D
<= 0.6
F
Entry
A float number between 0 and 1.
Exit
The letter corresponding to the score assigned according to the table above.
If the input is not within the range of 0 to 1 (inclusive), the function should return the legend "bad score" (without the quotes).
Program execution examples
>>> 0.95
TO
>>> 10.0
wrong score
>>> 0.5
F
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr