Starting from:
$30

$24

Laboratory #5 Solution

NOTE:




Please submit only C++ source files (*.cpp) to Blackboard.



Please put your name, project description, and date on the top of your file as a comment.
PLEASE WORK ALONE. If cheating is found, you will get ZERO.



1. (Lastname_Lab4_p1.cpp) Write a program that continuously requests a grade to be entered. If the grade is less than 0 or grater than 100, your program should print an appropriate message informing the user that an invalid grade has been entered; otherwise, the grade should be added to a total. When a grade of 999 is entered, the program should exit the repetition loop and compute and display the average of the valid grades entered. Verify the program using appropriate test data.




2. (Lastname_Lab4_p2a.cpp) a) A bowling team consists of fiver players. Each player bowls three games. Write a program that uses a nested loop to enter each player’s individual scores and then computes and displays the average score for each bowler. Assume that each bowler has the following scores:




1st bowler:
286
252
265
2nd bowler:
212
186
215
3rd bowler:
252
232
216
4th bowler:
192
201
235
5th bowler:
186
236
272
(Lastname_Lab4_p2b.cpp)
b) Modify the program to calculate and display the average
team score.












(Lastname_Lab4_p3.cpp) A bookstore summarizes its monthly transactions by keeping the following information for each book in stock:



Book identification number

Inventory balance at the beginning of the month

Number of copies received during the month

Number of copies sold during the month




Write a program that accepts this data for each book and then displays the book identification number and an updated book inventory balance using the relationship




New balance = Inventory balance at the beginning of the month

Number of copies received during the month - Number of copies sold during the month
Your program should keep requesting and display results until a sentinel identification value of 999 is entered.




(Lastname_Lab4_p4.cpp)



Write a function named check() that has three arguments. The first argument should accept an integer number, the second argument a double precison number and the third argument a double precision number. The body of the function should just display the values of the data passed to the function when it is called. (Note: When tracking errors in functions, it is helpful to have the function display the values it has been passed.)
Include the function check() in a working program. Make sure your function is called from main(). Test the function by passing various data to it.



(Lastname_Lab4_p5.cpp)



Write a function named findAbs() that accepts a double precision number passed to it, computes its absolution value, and display the absolute value. The absolute value of a number is the number itself if the number is positive or zero and is negative of the number if the number is negative.
Include the function findAbs() in a working program. Make sure your function is called from main(). Test the function by passing various data to it.

More products