Question: in C++ Write a program that performs the following tasks: 1. Define two structs dateType and employeeType. The dateType has the following members: Year of

in C++

Write a program that performs the following tasks:

1. Define two structs dateType and employeeType.

The dateType has the following members:

Year of type int

month of int

day of int.

The employeeType has the following members:

firstName of string

lastName of string

dob of dateType

salary of double

2. Assume a data file

hw2data.txt

contains 20 employees data. Each line has the employee

data in the order of first name, last name, year of birth, month of birth, day of birth, and salary.

Your program reads data from the hw2data.txtfile and store them into appropriate struct variable(s).

Hints: This assignment involves the use of nested structs and array of structs.

3. Define a function printEmployee that prints out one employees complete information in the order of first name, last name, date of birth in the form of yyyy-mm-dd, and salary. In the main function, call this function to output all 20 employees data in a neat form similar to the sample output.

Hints: Consider using manipulators (setw, left, right, setfill) to format the output.

4. Find and display the average salary of the 20 employees.

5. Find the oldest employee and output his/her name and year of birth.

Hints: Assume the oldest employees year of birth is different

from any other employees, so you

dont have to compare year, then month, and day.

The input data file

hw2data.txt

can be downloaded separately.

Alice Brown 1980 12 5 56980

Bob Bush 1972 3 26 120500

Carl Capra 1990 5 12 45200

David Lieberman 1976 11 26 87000

John Menchin 1983 4 20 78000

George Smith 1955 7 17 156000

Elaine Sanders 1987 6 20 47382

Jack Cunningham 1979 7 28 84570

Susie Brown 1995 8 24 65000

Marvella Garcia 1980 3 27 87444

Tony Peterson 1988 1 31 57388

John Jones 1960 10 23 129600

Mary Evans 1992 4 17 67358

Nancy Drew 1982 8 19 87890

Lola Zapeta 1976 12 16 93820

Duckey Donald 1969 6 23 98598

Goof Goofy 1952 4 28 102500

Brave Balto 1965 8 19 98676

Snow Smitn 1986 9 3 78644

Alice Wonderful 1993 11 29 67220

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!