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)
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
|