Decision Tool
You are trying to decide if a job is right for you, but there are many factors to consider and it is overwhelming. Write a program that considers your rating of several factors for a potential job, and calculates whether or not it is a good option.
Requirements
- Represent each of the following factors as variables: salary, travel distance, difficulty, stability, opportunity for progress, enjoyability, benefits, and reputation.
- Write a set of conditions (such as a maximum or minimum value for each variable) that must all be met in order to accept a job.
- Set the variable values to be your score for each feature as is relates to the potential job (for example difficulty = 7).
- For features without clear values, use a score from 0 to 10.
- Have it output "Accept the job" if all of the conditions are met, otherwise have it say "Don't work there".
- If the benefits condition fails, have it override that failure if the salary is sufficiently higher than the minimum acceptable salary you set.
Extra Challenge
For a job that fails the test, also have it display all the reasons that it failed.
Don't work there.
- The salary is too low.
- There isn't enough opportunity for progress.
- It's lacking in benefits
Hints
Keeping track of success conditions
It may help to have a variable to keep track of the success condition, set it true by default but mark it false if any condition isn't met. Then check it in the end.
boolean success = true;
if (difficulty > 8) {
success = false;
// ...
}
Keeping track of reasons for failure
It may help to have a string variable to keep track of the reasons for failure. Then you can append lines to it for each failure, and display the whole string in the end.
failReasons += "- The salary is too low.\n"