Create a function accepts a score for a class


Discuss the below:

Q1- Write a function that accepts a score for a driver's license facility, an int or a float, and returns a letter. If the score passed in is less than 75, then the letter returned is an F for Fail. Otherwise, the letter returned is a P for Pass.

The logic in this function must use a ternary operator.

Q2- Write a function that accepts a numeric reading from an industrial instrument, an int or a float, and returns an int. If the reading passed in falls between 40 and 80, the number returned is a 1. If the reading passed in falls between 100 and 140, then the letter returned is a 2. If the reading passed in falls between 180 and 200, then the letter returned is a 1. A value of 0 is returned if a reading outside these values is passed in.

The logic in this function must use if - else statements.

Q3- Write a function that accepts a score for a class, an int or a float, and returns a letter grade. If the score passed in is equal to 4, then the letter returned is an A. If the score passed in is equal to 3, then the letter returned is a B. If the score passed in is equal to 2, then the letter returned is a C. If the score passed in is equal to 1, then the letter returned is a D. Otherwise, the letter returned is an F.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create a function accepts a score for a class
Reference No:- TGS01937446

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)