a student designed a program to accept the age of an employee and then compute the employees retirement year and display the same in a statement on the screen required.

a) write out the pseudo-code for the program above
b) write the algorithm,
c) flowchart
d) write the program in c

string[] dDate = dob.Split('/');

string dDay = dDate[0];
string dMonth = dDate[1];
string dYear = dDate[2];
if (Convert.ToInt32(dDay) > 01)
{
if (Convert.ToInt32(dMonth) == 01 || Convert.ToInt32(dMonth) == 03 || Convert.ToInt32(dMonth) == 05 || Convert.ToInt32(dMonth) == 07 || Convert.ToInt32(dMonth) == 08 || Convert.ToInt32(dMonth) == 10 || Convert.ToInt32(dMonth) == 12)
{
RYear = Convert.ToInt32(dYear) + 60;
RMonth = Convert.ToInt32(dMonth);
RDay = 31;
}
else if (Convert.ToInt32(dMonth) == 04 || Convert.ToInt32(dMonth) == 06 || Convert.ToInt32(dMonth) == 09 || Convert.ToInt32(dMonth) == 11)
{
RYear = Convert.ToInt32(dYear) + 60;
RMonth = Convert.ToInt32(dMonth);
RDay = 30;
}
else if (Convert.ToInt32(dMonth) == 02)
{
if ((Convert.ToInt32(dYear) % 4) == 0)
{
if ((Convert.ToInt32(dYear) % 100) == 0)
{
if ((Convert.ToInt32(dYear) % 400) == 0)
{
RYear = Convert.ToInt32(dYear) + 60;
RMonth = Convert.ToInt32(dMonth);
RDay = 29;
}
if ((Convert.ToInt32(dYear) % 400) != 0)
{
RYear = Convert.ToInt32(dYear) + 60;
RMonth = Convert.ToInt32(dMonth);
RDay = 28;
}
}
if ((Convert.ToInt32(dYear) % 100) != 0)
{
RYear = Convert.ToInt32(dYear) + 60;
RMonth = Convert.ToInt32(dMonth);
RDay = 29;
}
}
if ((Convert.ToInt32(dYear) % 4) != 0)
{
RYear = Convert.ToInt32(dYear) + 60;
RMonth = Convert.ToInt32(dMonth);
RDay = 28;
}
}
//like wise we can do for month 01 but here retirement month will be minus 1 from curretnt month

wow. Things would have been have been a lot more compact if you had used an array of month days:

modays[12] = [0,31,28,31,30,...]
and then just adjusted the 28 as needed for the leap year.

a) Pseudo-code for the program:

1. Start
2. Declare variables: age, retirementYear
3. Input the age of the employee
4. Calculate the retirement year by adding 65 to the age
5. Display the retirement year in a statement on the screen
6. End

b) Algorithm:

1. Start
2. Define variables: age, retirementYear
3. Read the age of the employee from the user
4. Set retirementYear = age + 65
5. Display "The retirement year for the employee is [retirementYear]" on the screen
6. End

c) Flowchart:
```
Start
|
V
Enter age
|
V
Set retirementYear = age + 65
|
V
Display "The retirement year is [retirementYear]"
|
V
End
```

d) Program in C:

```c
#include<stdio.h>

int main() {
int age, retirementYear;

// Input age
printf("Enter the age of the employee: ");
scanf("%d", &age);

// Calculate retirementYear
retirementYear = age + 65;

// Display retirementYear
printf("The retirement year for the employee is %d\n", retirementYear);

return 0;
}
```

a) Pseudo-code for the program:

1. Accept the age of the employee as input.
2. Subtract the age from the retirement age to get the remaining years until retirement.
3. Compute the retirement year by adding the remaining years to the current year.
4. Display the retirement year in a statement on the screen.

b) Algorithm:
1. Start the program.
2. Prompt the user to enter the age of the employee.
3. Read and store the input age in a variable.
4. Subtract the age from the retirement age (e.g., 65) to get the remaining years until retirement.
5. Compute the retirement year by adding the remaining years to the current year.
6. Display the retirement year in a statement on the screen.
7. End the program.

c) Flowchart:
Here is a basic representation of the flowchart for the program:

START -> Prompt for age -> Read and store age -> Subtract age from retirement age -> Compute retirement year
-> Display retirement year -> END

d) Program in C:
Here is an example program in C that implements the given functionality:

```c
#include <stdio.h>

int main() {
int age, retirementAge = 65;
int currentYear = 2021;
int remainingYears, retirementYear;

printf("Enter the age of the employee: ");
scanf("%d", &age);

remainingYears = retirementAge - age;
retirementYear = currentYear + remainingYears;

printf("The employee's retirement year is: %d\n", retirementYear);

return 0;
}
```

Note: This C program assumes that the retirement age is fixed at 65 and the current year is 2021. You can modify the values as needed.