Starting from:
$30

$24

Laboratory #9 Solution

NOTE:

-Please submit only C++ source files (*.cpp) through the 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.




(Lastname_Lab9_p1.cpp, 20 points)
Write a function named days() that determines the number of days since January




1, 1900 for any data passed as a structure. Use the Date structure:

struct Date { int month; int day; int year;};




In writing the days() function, use the convention that all years have 360 days and each month consists of 30 days. The function should return the number of days for any Date structure passed to it. Write a main() function to test your function.




2. (Lastname_Lab9_p2.cpp, 20 points)




Write a program named difDays() that calculates and returns the difference between two dates. Each date is passed to the function as a structure using the following global type:

struct Date { int month; int day; int year;};




The difDays() function should make two calls to the days() function written for Lab9_p1.




(Lastname_Lab9_p3.cpp, 20 points)
Write a C++ function named older() to take two person’s birthdays, determine




who is older, and return the older birthday. Include older()function in a complete program. Store the Date structure returned by older() in a separate Date structure and display the member values of the returned Date in main()function.




(Hint: You can use Date structure, days() and difDays() in Lab9_p1 and Lab9_p2 to implement this problem.)




4. (Lastname_Lab9_p4.cpp, 20 points)




Declared a single-structure date type suitable for an employee structure of the type illustrated:




Number
Name
Rate
Hours
1322
Adam
5.62
41
6233
Jacob
6.83
39
5785
William
5.42
47
7631
Sam
7.19
41
8167
Peter
7.87
36



Using the data type declared, write a C++ program that interactively accepts the above data into an array of six structures. Once the data have been entered, the program

should create a payroll report listing each employee’s name, number, and gross pay.

Include the total gross pay of all employees at the end of the report.




5. (Lastname_Lab9_p5.cpp, 20 points)




Modify the problem 4, write a function called highest() to take those six employees, determine whose pay is highest and return that employee. Include highest()in main() function and display the name of whose payment is highest in main() function.

More products