Answered step by step
Verified Expert Solution
Question
1 Approved Answer
With this assignment, you have to help people to make decisions on the best way to have fun. Your recommendation should be based on three
With this assignment, you have to help people to make decisions on the best way to have fun. Your recommendation should be based on three factors:
- How much money is available,
- Whether the weather is nice, and
- Whether a car is available.
You will need to create a public static method called funDecision that takes a double parameter called money, and two boolean parameters called isWeatherNice and hasCar, respectively. The method returns a String specifying the recommended activity.
The decision is reached by abiding to the following rules:
- If money is not available (money < $50), the recommendation is to stay home and watch TV or go to the park, depending upon the weather.
- If money is available and the weather is nice, the choices are to go to the park or go to the beach, depending upon the availability of a car (the park is nearby, the beach is not).
- If money is available but the weather is uncooperative, the choices are to stay home and either play poker or go to the movies, again depending upon the availability of a car.
- If the money input is less than zero, return Invalid input.
The EXACT output of the method must be one of:
- Go to the beach
- Go to the park
- Go to the movies
- Play poker at home
- Watch TV
- Invalid input
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