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. 👍 0
  2. 👎 0
  3. 👁 426
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

    1. 👍 0
    2. 👎 0
    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.

    1. 👍 0
    2. 👎 0
    posted by Steve

Respond to this Question

First Name

Your Response

Similar Questions

  1. 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

    asked by martin on May 12, 2011
  2. Computer science

    need help how do this program. Use the top-down modular approach and pseudocode to design a suitable program to solve it. Alberta Einstein teaches a business class at Podunk University. To evaluate the students in this class, she

    asked by Poohboi on August 30, 2015
  3. 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

    asked by Wayne on March 6, 2010
  4. CIS115

    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

    asked by John on September 3, 2010
  5. computer

    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

    asked by Anonymous on January 3, 2011
  6. 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

    asked by Shawn on April 30, 2010
  7. 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

    asked by Anthony on November 15, 2010
  8. programming logic

    The program will accept user input to store the student's first and last name . If the name is ZZZ, then the program will end. The program will accept: a text entry for the class number (e.g., CGS 1000, COP 1000, etc.) a numeric

    asked by jay on February 20, 2012
  9. 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

    asked by jesse on January 28, 2011
  10. management

    The employee's performance objectives a. are designed by th employee only, b. ignore past work goals and objectives c. are designed by the supervisor only d.outline the employee's goals for the coming year.

    asked by stella on November 23, 2009

More Similar Questions