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

  Explain characteristics unique to object-oriented programing

The machine language treats a message as bits while object-oriented programming language treats every message as an object. Do you agree with this statement? Why or why not? Explain the characteristics unique to object-oriented programming and how..

  Write a small program to simulate a raffle

Write a small program to simulate a raffle (a gambling game) for a group with 100 members. You can simply identify each member with a no-duplicated ID numbers from 01 to 100. A number ticket with a positive 4-digits integer number will be randomly cr..

  Generate a random number each time the operator is used

The function call operator is overloaded and will generate a random number each time the operator is used and objects can be created with the lower and upper bound of the random number specified.

  What would be the coding for this process

If I have a panorama, and want to stitch the 3 photos together perfectly (just lining them up along the edges to create one long photo, no matching needed), what would be the coding for this process?

  Write a recursive void function

Write a recursive void function called rot at eLeft that rotates the first n integers in an array to the left. To rotate n items left, rotate the first n - 1 items left recursively, and then exchange the last two items. For example, to rotate the ..

  Implement a program for displays a maze of ascii symbols

Design and implement a C++ program for displays a maze of ASCII symbols on the screen and perform simple calculations.

  Write a program that prints the day number of the year

Write a program that prints the day number of the year, given the date in the form month-day-year. For example, if the input is 1-1-2006, the day number is 1.

  Write an application that creates a quiz

Write an application that creates a quiz, which contains at least 5 questions about a hobby, popular music, astronomy, or any other personal interest.

  Write a linked-list-based push-down stack implementation

Write a linked-list-based push-down stack implementation that keeps items on the list in order from least recently inserted to most recently inserted. You will need to use a doubly linked list.

  Requires the number of bits for the exponent

Write a program that requires the number of bits for the exponent and significant of a Floating Point representation; then requires two decimal real numbers and an operation either sum

  Write a c program that will calculate the gross pay of a

write a c program that will calculate the gross pay of a set of employees.for each employee the program should prompt

  Normalization of database tables

Using the STUDENT table structure shown in Table, do the following: Table: Sample STUDENT Records

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