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

asked by riley
  1. 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

    posted by Matt
  2. 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.

    posted by Steve

Respond to this Question

First Name

Your Answer

Similar Questions

  1. computers

    I have just started a basic class in programming and I am totally lost. Can someone help me out? I have to write pseudocodes and create flowchart and don't have a clue. I need help with the following: flowchart, pseudo-code, Input
  2. computer Programming

    A small startup software developer company needs to create a program that will calculate the pay of its employees. For the third version of the program, the company wants the program to accept an employee’s name, the number of
  3. computer programming

    small startup software developer company needs to create a program that will calculate the pay of its employees. For the third version of the program, the company wants the program to accept an employee’s name, the number of
  4. Java Programming

    I'm new to Java and I'm not sure how to write the source code for this problem I got in class... Write a java program using the while and if statement that will accept ten student grades and that will display the sum of the
  5. programming

    A small startup software developer company needs to create a program that will calculate the pay of its employees. For the first version of the program, the company wants the program to accept an employee’s name, the number of
  6. programing

    A small startup software developer company needs to create a program that will calculate the pay of its employees. For the third version of the program, the company wants the program to accept an employee’s name, the number of
  7. comper science

    write a program that accept the name of a student score obtained in 5 courses and compute the average score of the student.your program must display the name of that student on tab 5
  8. computer science

    Write a complete C# program that displays a menu comprising of the followings: Main Menu 1) Calculate Fuel Consumption 2) Calculate Weekly Wages 3) About This Program 4) Exit Program Enter your Choice: Calculating Fuel Consumption
  9. computer Science (need answer ASAP)

    Write a complete C# program that displays a menu comprising of the followings: Main Menu 1) Calculate Fuel Consumption 2) Calculate Weekly Wages 3) About This Program 4) Exit Program Enter your Choice: Calculating Fuel Consumption
  10. programing

    small startup software developer company needs to create a program that will calculate the pay of its employees. For the third version of the program, the company wants the program to accept an employee’s name, the number of

More Similar Questions