c programming

posted by riley

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

    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

  2. Steve

    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.

Respond to this Question

First Name

Your Answer

Similar Questions

  1. 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 hours …
  2. computers

    I have just started a basic class in programming and I am totally lost. Can someone help me out?
  3. 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 hours …
  4. 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 hours …
  5. 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 hours …
  6. 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 hours …
  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. c++ programming

    Solve the following problem. Apply all the steps i.e decomposition, Flowcharting and Pseudo code. Also write C++ program. Design and Write an interactive program that computes the salary in Rupees of a part-time employee based on: …
  9. Programming logic and design

    Design a program that lets the user enter the total rainfall for each 12 months into an array. The program should calculate and display the total rainfall for the year the average monthly rainfall, and the month with the highest and …
  10. 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 grades, …

More Similar Questions