Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Info taken from: https://www.bls.gov/careeroutlook/2016/data-on-display/educati

ID: 3787053 • Letter: #

Question

(Info taken from: https://www.bls.gov/careeroutlook/2016/data-on-display/education-matters.htm)

It is well documented that an individual’s average salary increases as their education level (i.e. degrees) increase. “More education leads to better prospects for earnings and employment. According to data from the U.S. Bureau of Labor Statistics, earnings increase and unemployment decreases as educational attainment rises.”

Write a SINGLE java program called called Proj2.java to do the following:

1) Display the following menu:

1 = No Degree

2 = High School Degree

3 = Bachelor’s Degree

4 = Masters Degree

5 = Doctorate Degree

Ask the user to enter the number that corresponds to their education level

If an invalid number is entered (not a 1-5), display the following error message then exit the program. "You entered an invalid menu choice. Please re-run the program and enter in a valid choice." (You are also welcome to loop until a valid choice is entered, but it is not required)

2) Get the current year, the user’s current age, and the age they plan on retiring (see sample run below).

3) Display the following:

a) Annual salary for that degree

b) Retirement age, retirement year and the total amount user will earn over their lifetime with that degree (based on current age and retirement age)

c) How much more they earn with that degree compared to all previous degrees

For example, if they have a Bachelor’s Degree, display how much more they earn than with a High School Degree or No Degree. For No Degree, don’t display this portion.

d) How much more they can earn for each subsequent degree.

For example, if they have a Bachelor’s Degree, display how much more they earn than with a Master’s and a Doctorate. With No Degree, how much more than can earn with a HS degree, a Bachelor’s Degree, a Masters degree, and a Doctorate. For Doctorate, don’t display this portion.

General Requirements:

Use constants to represent the dollar amounts for each degree, (so they could be easily updated). (You might also want to use constants to represent the degrees, such as 0=None, 1=High School, etc.)

Format ALL currency output w/a preceding ‘$’-sign, commas (if needed), to 0-decimal places.

To simplify grading, the output of your program should look EXACTLY like the examples shown (except, of course, different values if the user enters different numbers). This includes spacing, capitalization, spelling, etc.

Please make it compatible with java language, with a single class and a main method.

Explanation / Answer

below is your program working,tested,

note:

The EXAMPLES / SAMPLES you mentioned in your question ARE NOT PRESENT .

-----------------------------------------------------------------------------------------------------------------------

Proj2.java

import java.io.* ;
import java.util.Scanner;
public class HelloWorld{

public static void main(String []args){
System.out.println("please select 1-5 from menu below");
System.out.println("1 = No Degree");
System.out.println(" ");
System.out.println("2 = High School Degree");
System.out.println(" ");
System.out.println("3 = Bachelors Degree");
System.out.println(" ");
System.out.println("4 = Masters Degree");
System.out.println(" ");
System.out.println("5 = Doctorate Degree");
System.out.println(" ");
System.out.println("Enter your choice: ");
Scanner scanner = new Scanner(System.in);
int c = scanner.nextInt();
if (c==0 || c>5)
{System.out.println(" You entered an invalid menu choice. Please re-run the program and enter in a valid choice.");
}
//taking input form user current year, the users current age, and the age they plan on retiring
System.out.println("Enter Current year: ");
int cyear = scanner.nextInt();
System.out.println("Enter your age: ");
int age = scanner.nextInt();
System.out.println("When you are planning to retiring(age):");
int rage = scanner.nextInt();
int hsalary=41496;
int bsalary=59124;
int msalary=69732;
int dsalary=84396;
//condtion loops
if (c==1){
//Annual salary for that degree
//System.out.println(" Annual salary for "+c+": No Degree is: null");
//Retirement age, retirement year and the total amount user will earn over their lifetime with that degree
System.out.println(" Retirement Age "+rage);
int tage=rage-age;
int ahsincome=tage*hsalary;
int abincome=tage*bsalary;
int amincome=tage*msalary;
int adincome=tage*dsalary;
System.out.println("total amount you will earn in lifetime with High School Degree is: $"+ahsincome);
System.out.println("total amount you will earn in lifetime with Bachelors Degree is: $" +abincome);
System.out.println("total amount you will earn in lifetime with Masters Degree is: $"+amincome);
System.out.println("total amount you will earn in lifetime with Doctorate Degree is: $"+adincome);

}
if (c==2){
int tage=rage-age;
int ahsincome=tage*hsalary;
int abincome=tage*bsalary;
int amincome=tage*msalary;
int adincome=tage*dsalary;
//Annual salary for that degree
System.out.println(" Annual salary for "+c+": High School Degree is: $"+hsalary);
//Retirement age, retirement year and the total amount user will earn over their lifetime with that degree
System.out.println(" Retirement Age "+rage);
System.out.println("total amount you will earn in lifetime with High School Degree is: $"+ahsincome);
System.out.println(" ");
  
  

System.out.println("total amount you will earn in lifetime with Bachelors Degree is: $" +abincome);
System.out.println("total amount you will earn in lifetime with Masters Degree is: $"+amincome);
System.out.println("total amount you will earn in lifetime with Doctorate Degree is: $"+adincome);

}
if (c==3){
int tage=rage-age;
  
int abincome=tage*bsalary;
int amincome=tage*msalary;
int adincome=tage*dsalary;
//Annual salary for that degree
System.out.println(" Annual salary for "+c+": Bachelors Degree is: $"+bsalary);
//Retirement age, retirement year and the total amount user will earn over their lifetime with that degree
System.out.println(" Retirement Age "+rage);
System.out.println("total amount you will earn in lifetime with Bachelors Degree is: $" +abincome);
System.out.println(" ");
  
System.out.println("total amount you will earn in lifetime with Masters Degree is: $"+amincome);
System.out.println("total amount you will earn in lifetime with Doctorate Degree is: $"+adincome);

}
if (c==4){
int tage=rage-age;
int amincome=tage*msalary;
int adincome=tage*dsalary;
//Annual salary for that degree
System.out.println(" Annual salary for "+c+": Masters Degree is: $"+msalary);
//Retirement age, retirement year and the total amount user will earn over their lifetime with that degree
System.out.println(" Retirement Age "+rage);
System.out.println("total amount you will earn in lifetime with Masters Degree is: $"+amincome);
System.out.println(" ");
  
System.out.println("total amount you will earn in lifetime with Doctorate Degree is: $"+adincome);

}

}}