Tuesday, July 28, 2009

C++ Write a program that does the following?

Write a program that does the following.


1. Repeatedly read a student score (for an exam) and add it to a running sum. Count the number of scores entered. (We’ll assume that the scores are between 0 and 100.) Stop when the user enters a negative number. Output the sum and count of the scores.


2. Define a function average that, passed the sum of the scores and the count of the scores, computes the average score, which it returns. In main, call this function just after the above loop, and output the average score that the function returns.


3. Define a function validScore that, passed a score, returns true if the score is between 0 and 100 and otherwise returns false. Using this function, modify the loop that reads in the scores so that, if the score is not valid, it is echoed with a message saying that the score is invalid, and so that the score is counted and added to the sum only when it is valid. (Note that there is some redundancy as validScore is used here since the loop exits when a negative score is entered—so validScore is never passed a score that is invalid because it is negative.)


4. Define a function letterGrade that, passed a valid score (one between 0 and 100), returns a letter grade according to the following schedule:


‘A’: 90 and above


‘B’: 80-89


‘C’: 70-79


‘D’: 60-69


‘F’: below 60


Use this function to find the letter grade corresponding to each valid score and output the letter grade as soon as it is found. Keep a count of the number of each letter grade (‘A’-‘F’) and output each count at the end of the run.

C++ Write a program that does the following?
What type fee (meaning how much in US dollars) are you willing to pay for the development of the algorithm, coding, and testing phases of this program?
Reply:Brother assignments are not captured at yahoo answers. Grab your brain


No comments:

Post a Comment