Avery Lake Resort & Spa
As activity director at Avery Lake Resort & Spa, it is your job to suggest appropriate activities to resort guests based on the weather:
If the temperature is more than 75 degrees, suggest wind sailing on beautiful Avery Lake.
If the temperature is at least 65 degrees but not warm enough for wind sailing, suggest horseback riding at the renown Avery Equestrian Center.
If the temperature is at least 45 degrees but not warm enough for horseback riding, suggest that the guest goes mountain biking on Avery Trails.
If the temperature is not warm enough for horseback riding, then encourage the guest try Cycling or kickboxing in the Avery Fitness Center.
1. Write a program that prompts the user for a temperature in Fahrenheit. Use if/else statements to recommend a resort activity based on the outdoor temperature. Be sure that your conditions are no more complex than necessary. In addition to printing the suggested activity, in all cases, also print Avery Lake Resort & Spa: Something for Everyone!
For example, if the outdoor temperature is 78 degrees, the program would print: We suggest you enjoy wind sailing on beautiful Avery Lake Avery Lake Resort & Spa: Something for Everyone!
If the outdoor temperature is 42 degrees, the program would print: We suggest you enjoy cycling or kickboxing in the Avery Fitness Center Avery Lake Resort & Spa: Something for Everyone!
2. Modify your program so that if the temperature is greater than 95 or less than 20, the program suggests that guests "Visit Avery Spa for 15% off a facial or 10% off a hot stone massage". For other temperatures print the activity as before.
CODE:-
import java.util.*;
public class Main
{
public static void main(String[] args) {
float temp;
Scanner sc = new
Scanner(System.in);
System.out.println("Enter the
temperature : ");
temp = sc.nextFloat();
sc.nextLine();
if(temp>=95 || temp<20)
{
System.out.println("Visit Avery Spa
for 15% off a facial or 10% off a hot stone massage");
}
else if(temp>=75 &&
temp<95)
{
System.out.println("We suggest you
enjoy wind sailing on beautiful Avery Lake, Avery Lake Resort &
Spa: Something for Everyone!");
}
else if(temp>=65 &&
temp<75)
{
System.out.println("We suggest you
enjoy horseback riding at the renown Avery Equestrian Center, Avery
Lake Resort & Spa: Something for Everyone!");
}
else if(temp>=45 &&
temp<65)
{
System.out.println("We suggest you
enjoy mountain biking on Avery Trails, Avery Lake Resort & Spa:
Something for Everyone!");
}
else if(temp<45 &&
temp>20)
{
System.out.println("We suggest you
enjoy Cycling or kickboxing in the Avery Fitness Center, Avery Lake
Resort & Spa: Something for Everyone!");
}
}
}
OUTPUT:-
Get Answers For Free
Most questions answered within 1 hours.