Question: Programming Assignment: OfferDecision Problem Statement: This assignment will acquaint you with the use of parameter passing, return values, if / else blocks, and user input.
Programming Assignment: OfferDecision
Problem Statement:
This assignment will acquaint you with the use of parameter passing, return values, ifelse blocks, and user input. You will create a program that helps Maya decide whether to accept one of the two offers she has received based on her preferences. Specifically, your program prompts for the information regarding two job offers, then checks to see if any of the offers is acceptable and returns the final decision on which offer is accepted, if any. Maya's preferences can be summarized as follows:
Maya is looking for her dream job but has some preferences. She hates Massachusetts and so demands at least $ per year to work there. She likes Washington state, so she would take a job there if it paid $ or more per year. But she really loves California, so she would take a job there if it paid more than $ per year. At any other place, she will work for at least $ per year. Given
these preferences, she wants to first check whether each of the two offers is acceptable and then pick the
one with the higher salary. If both are acceptable and they both offer the exact same salary, she will take
up the first offer.hand, if not acceptable, it returns the value of the class constant REJECTEDSALARY which is
initialized to be a negative number
points compareAndPrintDecision method accepts arguments company, state code, and
salary for both the offers. It calls the acceptableSalary method twice passing the information for
each offer. It analyzes the returned values and makes the final decision according to Maya's
preference above and prints the final decision. See the sample runs below.
points Include appropriate program documentation and formatting including: Your first and
last name, the date of submission, code comments necessary to explain the operation of your
program, and proper indentation of the code, etc.
Tips:
For each of the methods, think about the following: What is the return type, what parameters
will it need to perform the task, and accordingly decide the method signature for each.
To be able to use a single Scanner object effectively you will have to pass it to all the methods
that prompt the user for input.
You can simplify the logic of your ifelse statements by using the logical operators & & and II
given on page of the textbook.
Sample runs: Text in orange is what user has entered as input.
Sample run : both the offers are acceptable, the first one has a higher salary, the first one accepted.
jGRASP exec: java offerDecision
Congratulations, Maya! You got two job offers!
Enter information about the first offer
Please enter the company name: Microsoft
Please enter the letter state code: WA
Please enter the yearly salary:
Enter information about the second offer
Please enter the company name: Google
Please enter the letter state code:
Please enter the yearly salary:
Hurray! The first offer accepted.
Joining Microsoft in WA
jGRASP: operation complete.
Sample run : neither of the offers are acceptable, none of them is accepted.
jGRASP exec: java OfferDecision
Congratulations, Maya! You got two job offers!
Enter information about the first offer
Please enter the company name: Microsoft
Please enter the letter state code: FL
Please enter the yearly salary:
Enter information about the second offer
Please enter the company name: DishaTech Please enter the letter state code: Please enter the yearly salary: offer accepted :-( Job hunt continues. GGRASP: operation complete.
Sample run : only one of the offers is acceptable, it is accepted.
Sample run : both offers are acceptable and have equal salary. The first one is accepted.
Congratulations, Maya! You got two job offers!
Enter information about the first offer
Please enter the company name: HoustonElectric
Please enter the letter state code: TX
Please enter the yearly salary:
Enter information about the second offer
Please enter the company name: SanJoseElectric
Please enter the letter state code: CA
Please enter the yearly salary:
Hurray! The first offer accepted.
Joining HoustonElectric in TX
jGRASP: operation complete.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
