# c programming

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

1. 👍
2. 👎
3. 👁
1. string[] dDate = dob.Split('/');
string dDay = dDate;
string dMonth = dDate;
string dYear = dDate;
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

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

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

1. 👍
2. 👎

## Similar Questions

1. ### ALGORITHM

Write an algorithm and flowchart that will accept score of 30 student in a class calculate and print the average mark in basic program.

2. ### Programing

write a pseudocode for a program that asks for the Employee ID, the hours worked and the pay rate, then returns the employee's gross pay for the week?

3. ### science

Write a program that will accept two numbers. The program must calculate the LCM and HCF of the numbers and display it.

4. ### MATH

WRITE A SIMPLE BUT A COMPLETE FORTRAN PROGRAM TO COMPUTE THE AVERAGE OF SIX NUMBERS AND DISPLAY THE NUMBERS, SUM AND AVVERAGE. THE PROGRAM SHOULD TERMINATE WHEN ZERO IS ENTERED AS A NUMBER. THE PROGRAM SHOULD BE EDUCATIVE

1. ### Chemistry

A student was tasked to perform gravimetric analysis of a soluble sulfate. His unknown sample weighed 0.7543 g. The sample underwent precipitation using BaCl2 and was digested for overnight. The precipitate was then filtered off

2. ### Math

Note: Enter your answer and show all the steps that you use to solve this problem in the space provided. A survey about the student government program at a school finds the following results: 190 students like the program 135

3. ### visual basic programming

Write a Visual Basic program that will calculate the assessment marks of a student taking the Computer Programming subject in College. The program must be able to determine the total result and finally display the grade of that

4. ### Programming

Develop a Java application that will determine the gross pay for each of three employees. The company pays “straight line” for the first 40 hours worked by each employee and pays “time and a half” for all hours worked in

1. ### Information Technology

Develop an algorithm, flow chart and pseudocode that accept as input three unit test scores and a project score for seven students. The algorithm, flow chart and pseudocode should accept seven examination scores. The students's

2. ### CIS 115

Design a solution that requests and receives student names and an exam score for each. The program should continue to accept names and scores until the user inputs a student whose name is “alldone”. ***After the inputs are

3. ### Computer Science

Write a program that welcomes the user to the Payroll Calculator and prompts him to enter an employee first name, an employee last name, an hourly rate of pay, and the number of hours worked. The program should display the

4. ### Computer Programing & Logic Design

Submit pseudocode and a flowchart for the following programming exercise: Test Average and Grade Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the