Function that accepts a score for a driver''s license

Assignment Help C/C++ Programming
Reference no: EM13937715

It is required that in all assignments a Cast should be used to convert float to int.

1- 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.

2- 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.

3- 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.

The logic in this function must use a switch.

Prompt the user for input in the main function of the program for each of the above described functions, call each function, and display the result of each function.

Naming convention of functions and variables is left up to you.

as a tip for understanding the concept laid out that I have to follow:

I have to keep in mind the difference between the comparison operator in C, ==, and the assignment operator, =. When making boolean comparisons, makes sure that I use == and not use =.

Assignment:

int x = 5;
float fNum = 20;
total = subTotal + foodExpenses;

Comparison:

if ( x == 5)
printf("x is %d", x);
else if ( x == 20 )
printf("x is %d", x);

I don't want to have: if (x = 5)

Reference no: EM13937715

Questions Cloud

If a company produces less than it sells : Which method of computing net income will result in the higher net income? Why?
Write a method called check value : Get input for the starting number (assume important statement is already present)
Explain how fixed manufacturing costs are treated : Explain how fixed manufacturing costs are treated under variable costing. How are fixed manufacturing costs treated under full costing?
Laws for boolean algebras to convert : Given that there are 100 elements in A1, 1000 in A2, and 10, 000 in A3, find the number of elements in A1 ∪ A2 ∪ A3 in each of the cases below.
Function that accepts a score for a driver''s license : 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.
Natural convection from a horizontal heated surface : Consider natural convection from a horizontal heated surface. Use Buckingham Pi Theorem to determine which dimensionless number you would used to investigate this phenomenon.
Explain why the price increased in china in 2009 : The price of garlic in China increased forty-fold between March and November 2009. Due to low prices in the previous year, the amount of land set aside for growing garlic in 2009 have been halved in Chinea. As well there been rumours that garlic c..
Convert the function to disjunctive normal : Given that there are 100 elements in A1, 1000 in A2, and 10, 000 in A3, find the number of elements in A1 ∪ A2 ∪ A3 in each of the cases below.
Convert the following infix expressions to postfix : Convert the following infix expressions to postfix

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that will compute and display x

Write a program that will prompt the user for a value x then compute and display X / (ln(X)+2)

  Write a program that uses a loop to display projected rates

Write a program that will convert US dollar amounts to Canadian dollar (1 CND = 0.92 USD). Format your currency amounts in two decimal places and trailing zeros.

  Create a program that maintains the required book catalog

Create a program that maintains the required book catalog for the circulation desk of a library.

  Write a program that declares three one dimensional

Write a program that declares three one dimensional arrays named miles, gallons, and mpg . Each array should be declared in main( ) and should be capable of holding ten double

  A stack is referred to as a last-in first-out

This lab, along with your TA, will help you navigate through designing, implementing, and testing a dynamic stack. Recall, a stack data structure is a restricted linked list, where only the top node in the stack may be accessed at any given time

  Write a function that changes sign of each of negative float

Write the following function that changes the sign of each of the negative floats pointed to by the first n pointers in the array p: void abs(float* p[], int n).

  What is the difference between an object and a class

What is the difference between an object and a class? What is the difference between class and structure? What are virtual functions?

  A constructor and a destructor

A constructor and a destructor, Insert a new element chosen by the user at the correct place in the list

  Ask the user to enter the desired character

Write a very simple c program which will Ask the user to enter the desired character- Repeat the asking part until the user types a desired letter. For each even number of attempts

  Create a program that contains 4 methods

Create a program that contains 4 methods / functions... main(), getTestScores(), calcAverage(), and displayAverage(). The main() method should call the getTestScores() method to get and return each of 3 test scores.

  Program to output value of tenth component of array

Write a C++ statements to perform the following: Set value of fourth component of array alpha to three times  value of eight component minus 57.

  Savingsaccount objects and two checkingaccount objects

Develop a polymorphic banking application using the Account hierarchy you created. Create the following two SavingsAccount objects and two CheckingAccount objects and store them in an array called "arrays" of Account references to the objects

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd