Question

This is an extra credit assignment, more difficult than most. Since get a point in the course. irs an extra credit challenge, il give only minimal help. This assignment is one of the hardest ways to Improve your Retirement the company). program based on these rules. Eligibility for retirement is based on age (how oid the worker is and service (how long the worker has worked at 1. 30 and out: anyone with 30 years of service can retire, no mater how old 2. You can retire if you are 65 years old, no matter how many years of service 3. You can retire at age 60 with 20 years of experience. 4. You can retire at age 55 with 25 years of experience Use java The program should ask for the are not immediately eligible. For example, a person 21 yoars old with 1 year experience can retire in 29 can reire in 24 years (under rule 4); a 41 year old with 1 year can retire in 19 years (under rule 3; a 51 year old with 1 year can retire in 14 yoars (under nule 2), DEMO: 62 years (under rule 1) a person 31 years old with 1 year experience with 19 years of service.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

So this program checks if the retirement age is reached or not

there are four condition

1. anyone with 30 years of service can retire without boundation of age i.e anyone with 30 years or more (as it will include 30 years of service also) years of service can retire

2.anyone with 65 years can retire without boundation of service year i.e anyone with 65 years or more (as it will include 65 years of age) years can retire

3.also anyone with age 60 years with 20 years of experience which will include being more than that also can retire

4.also anyone with 55 years with 25 years of experience which will include being more than that also can retire.

So, according to all thee conditions the first if statement is made which will result in positive retirement age.

then after other conditions are made to find the years of wait for retirement which include checking all the above 4 conditions and choose the least years of wait (denoted by temp here).

we are using t1,t2 and temp for temporary calculations and temp stores the years.

import java.util.Scanner;
public class Test {

public static void main(String args[]) {
Scanner scnr = new Scanner(System.in);
int t1,t2,temp,s,y;

//taking input of age and service using java.util.scanner nextint takes the next integer as input
System.out.print("Enter your age");
y=scnr.nextInt();
System.out.print("Enter your service years");
s=scnr.nextInt();

//for the initial condition check
if( s >= 30 || y >= 65 || (y>=60 && s>=20) || (y>=55 && s>=25))
{
System.out.print("Eligible for retirement");
}else {

//else to find the wait
temp=65-y; //checking with first condition
if(temp>(30-s))
temp=30-s;

//checking with ssecond condition but also taking in account if it is lesser then the one calculated earlier
//checking for third condition which has conditions inside   

if(y<55)
{t1=55-y; t2=t1+s;

//getting the age difference and adding it in service to know if till that time it will 25 year of service

//if age less than 55 then we have to check for service greater andd less than 25
if(t2<25)
{t1=t1+(25-t2); //because both age and service condition should be fulfilled
}

//and check if it gives the least amount of wait
if(t1<temp)
temp=t1;
}

//then check for greater than 55 with service less than 25 as greater than has already been considered
else if(y>=55)
{//since age criteria is matched what is needed is service it is checked for least wait
if((s-25)<temp)
temp=s-25;
}

//as for 55 the conditions are checked for 60 years of age also.
if(y<60)
{t1=60-y; t2=t1+s;
if(t2<20)
{t1=t1+(20-t2);
}
if(t1<temp)
temp=t1;
}
else if(y>=60)
{
if((s-20)<temp)
temp=s-20;
}
  
// and then the years still needed to retire are printed whichis in temp
System.out.print("Not currently eligible for retirement still need" + temp + "years");
}
}
}

Add a comment
Know the answer?
Add Answer to:
This is an "extra credit assignment, more difficult than most. Since get a point in the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Module #6 Hand - In Assignment 1. An article on saving for retirement estimates that a...

    Module #6 Hand - In Assignment 1. An article on saving for retirement estimates that a 35 year old will need 1.2 million to retire at age 65. a. How much money should you deposit today to reach that goal if your investments will return 8% compounded semi-annually. b. You currently have only $80,000 in your retirement savings plan what semi-annual rate of return do you need to reach your retirement goal? (assume same return as a) c. You estimate...

  • The Certainty Company (CC) operates in a world of certainty. It has just hired Matt (age...

    The Certainty Company (CC) operates in a world of certainty. It has just hired Matt (age 20) who will retire at age 65, draw retirement benefits for 15 years, and die at age 80. Matt's salary is $20,000 per year, but wages are expected to increase at the 5% annual rate of inflation. CC has a defined benefit plan in which workers receive 1% of the final year's wage for each year employed. The retirement benefit, once started, does not...

  • 1. Blood Pressure Evaluation Assignment For this extra credit you need to get your blood pressure...

    1. Blood Pressure Evaluation Assignment For this extra credit you need to get your blood pressure checked from a doctor, nurse, student health center or other qualified health care professional (not the free machine at the local pharmacy). To receive the extra credit, two things are required: First, submit the results of the test and answer the following questions: 1. What is your Blood Pressure? 2. What category is this considered? 3. What is a healthy blood pressure range? 4....

  • ccepi My courses > 3001 > Homework NU. 4 Intro You just turned 25 years old...

    ccepi My courses > 3001 > Homework NU. 4 Intro You just turned 25 years old and want to retire when you turn 65. You plan to put $4,600 every year into a ROTH IRA, a retirement account from which you can withdraw money after retirement without having to pay any taxes. You expect to earn a return of 6% on your investments every year. Part 1 - Attempt 1/10 for 10 pts. How much money can you expect to...

  • It is your 25th birthday (end of 25 years) and you decide that you want to...

    It is your 25th birthday (end of 25 years) and you decide that you want to retire on your 65th birthday (end of 65 years - 40 years later). Your salary is $55,000 per year and you expect your salary to increase by 3% each year for the next 40 years. When you retire, you want your retirement fund to provide an annual payment equal to 80% of your salary at age 65 and to increase by 2% a year...

  • TVM Assignment Please answer the questions in an excel spreadsheet with the formulas showing. Part IV:...

    TVM Assignment Please answer the questions in an excel spreadsheet with the formulas showing. Part IV: Retirement Planning You realize the wisdom of starting early at age 22 in saving for your retirement and plan on making 43 equal end of year annual deposits in an IRA account in hopes of having at least $1,000,000 once you retire at age 65 (immediately after your last deposit into the IRA account), but you think it would be best to have $1,500,000...

  • Question 5 1 pts Your clients want help figuring out how much they need to save...

    Question 5 1 pts Your clients want help figuring out how much they need to save each month so that they can reach their retirement goal. If your clients are currently 40 years old and want to retire when they are age 68, how much do they need to save at the end of each month to reach their goal? They currently have $190,000 saved for retirement. Assume the following: • Your clients currently spend $100,000 (in today's dollars), and...

  • Question 4 1 pts Your clients want help figuring out how much they need to save...

    Question 4 1 pts Your clients want help figuring out how much they need to save each month so that they can reach their retirement goal. If your clients are currently 37 years old and want to retire when they are age 62, how much do they need to save at the end of each month to reach their goal? They currently have $180,000 saved for retirement. Assume the following: • Your clients currently spend $70,000 (in today's dollars), and...

  • Cholesterol and Glucose screening This extra credit assignment requires you to get your blood work checked. To receive t...

    Cholesterol and Glucose screening This extra credit assignment requires you to get your blood work checked. To receive this extra credit, two things are required; First, you need to submit the results of your blood test and include the following information: 1. What your scores are for the following; a. total cholesterol, b. HDL, c. LDL, d. Fasting blood glucose 2. List the healthy range for each of the above. 3. What diseases are people at risk for with high...

  • please reply with only the number answer to the underlined question. i do not want to...

    please reply with only the number answer to the underlined question. i do not want to see any other equations or numbers. just the answer to the underlined questions. thank you. Question 5 1 pts Your clients want help figuring out how much they need to save each month so that they can reach their retirement goal. If your clients are currently 37 years old and want to retire when they are age 63, how much do they need to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT