Question
Java Code for the following: Create a program that will allow a user to enter each persons favorite color, favorite number (between1 and 10, inclusive),
Java Code for the following:
Create a program that will allow a user to enter each persons favorite color, favorite number (between1 and 10, inclusive), and current number of friends.
After all values are entered, if no invalid values are entered, a compatibility rating will be calculated as follows:
The compatibility rating starts at 0
Two people with a matching favorite number adds 2 to the compatibility rating
Two people with a matching favorite color adds 5 to the compatibility rating
For each person, having less than 10 current friends adds 4 to the compatibility rating, while
having 10 or more current friends adds 1 to the compatibility rating
Once the compatibility rating is calculated, print a well-formatted message that includes the information collected for each person, the compatibility rating, and the level of compatibility. The level of compatibility is determined as follows:
For a compatibility rating of 7 or more, the level of compatibility is VERY COMPATIBLE
For a compatibility rating of 3 or less, the level of compatibility is NOT AT ALL
In all other cases, the level of compatibility is POSSIBLY COMPATIBLE
However, if after all values are entered there is at least one invalid value entered, the program should display an error message to contact the IT department and then end.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started