Write down a function that accepts a score for a class

Assignment Help Computer Engineering
Reference no: EM1331824

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: EM1331824

Questions Cloud

The most important bases of subunit power : Find the most important bases of subunit power in an organization?
How do companies forecast human resources : How do companies forecast human resources demand and supply - Given that work in organizations is managed and done by people (human resources)
Differences between criminal law and civil law : What are some of the differences between criminal law and civil law?  What is the purpose of having criminal laws, as opposed to just having a civil legal system?
Explain e-business and financial planning : Explain e-business and financial planning
Write down a function that accepts a score for a class : Write down 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.
Customizing hrm strategy to business strategies : Explain the ethical dilemmas that may arise if you use your expert knowledge of other organizational HRM strategies with the new client and show your approach to customizing HRM strategy to business strategies
The role of leadership : Find the role of leadership as it relates to vision, mission, and strategy
Find how to perform system calls in each operating system : Write a C++ or Java program that reads from one file and writes to another find how to perform system calls in each operating system.
Academic response to human resources : Academic response to Human Resources - Explain the nature and components of, and the issues currently facing, executive compensation in various U.S. industries.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Make the get/set methods for each of your variables

select a product that lends itself to an inventory (for example, products at your workplace, office supplies, music CDs, DVD movies, or software).

  Find out coding of binary information and error detection

find out Coding of Binary Information and Error Detection.

  Program to print a sequence of 20 random die tosses

Write down a program which produces a sequence of 20 random die tosses in an array and which prints the die values.

  Write program that computes the cost of a long distance call

Write program that computes the cost of a long distance call

  When does pipelining not offer any benefit

How does branch prediction, forwarding, and stalls help make a computer faster.

  What kinds of equipment used

examine applying a voice and video over IP solution for a company interested in enabling its geographically distributed sales force to collaborate efficiently. what kinds of solutions might you propose and what kinds of equipment.

  Which references source page fault with lru page replacement

Which references source a page fault with LRU page replacement policy? Illustrate your intermediate working in table below with three columns.

  Use electronic monitoring to measure employee productivity

assume that you are an IT consultant who has been given the task of preparing a report for the management board of a software house that is currently thinking of implementing electronic monitoring throughout its operations.

  How to plan a payroll class

How to plan a PayRoll class.

  Troubleshooting the software

AV software has eliminated the malware from highly infected system. After the first reboot, an error message is displayed that consists of the reference to strange DLL file that is missing.

  Context free language

Let L1 be the regular language and L2 be the context-free language, both described over the same alphabet Σ. a) Is L1∩L2 always regular? Explain your claim.

  Sql query to determine lowest, highest, average salary

Let's assume that we wanted to determine the lowest, highest, average and total number of the salaries by department in company. What SQL query would provide us this.

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