Question
Help code this problem in java , I need output only for when to wear sweatshirt and coat, not the whole thing. in other word
Help code this problem in java , I need output only for when to wear sweatshirt and coat, not the whole thing.
in other word i need output for when i will wear coat and sweatshirt for all activities. if there are activities i will not wear coat and sweatshirt , you will output:" you will not wear a top layer"
Given the weather, time of day, and the activity I have planned to do, help me pick out the correct outfit. I may need to wear layers, so give me the order to dress as well.
Input:
weather conditions (temperature (int) and sunny/rainy (boolean))
time of day (morning, mid-day, night (char))
activity options (bike, eat, hike, bake, read (String)) eat means going out for a meal
Output:
My outfit in order for getting dressed. (base layer, top layer, shoes & accessories)
How I decide what to wear:
If the temperature is 70 deg. Fahrenheit or above, I wear shorts and a t-shirt, unless I am going out to eat, then I wear a dress.
If the temperature is below 70 degrees Fahrenheit, I change into long pants and I throw on sweatshirt over my t-shirt. If I am going out to eat, I wrap myself in a shawl.
I wear a raincoat over my outfit if it is raining.
I wear a coat if it is below 50 deg. Fahrenheit. and a rain poncho over it only if is raining and it is above 32 deg. Fahrenheit.
If it is morning or night, and I am reading a book, I am wearing pajamas and slippers
I only wear socks with gym shoes, and I only wear gym shoes to bike or hike, otherwise I wear flats.
If I am baking, I tend to be messy, so I put on an apron.
If I am reading a book mid-day, I read outside and I wear sunglasses, unless it is raining, then, I read inside.
here is the code for the start :
import java.util.Scanner;
public class TopLayer
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
//input for weather conditions
System.out.println("Enter temperature: ");
int temp=sc.nextInt();
System.out.println("Enter True for Sunny False for Rainy: ");
boolean SunnyRainy=sc.nextBoolean();
sc.nextLine();
// input for time of the day
System.out.println("Enter m for Morning d for Mid-day n for Night");
char time=sc.nextLine().charAt(0);
// input for activity
System.out.println("Enter activity: ");
String activity=sc.nextLine();
String outfit="";
// if temperature less than 70 degrees activity bike
if(temp<70 && temp>50){
if(activity.equals("bike")){
outfit="You will not wear a top layer";
}
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