Write a complete program to give advice on clothing/accessories based on the weather. Your program should accomplish these steps, in order: Part One: User Input  ask the user what the temperature is and read in that value ask the user if there is precipitation (i.e., rain or snow) you can decide how to phrase that question and what to read in Part Two: Weather Advice Output  display information about the precipitation based on these rules: if there is no precipitation, tell the user that is dry  if there is precipitation, use the temperature to tell the user if it is raining or snowing display advice to the user about what to wear, following these rules if it is very cold, wear a heavy coat; if it's moderate, wear a light coat if there is precipitation: wear a hat (if it's very cold), wear a warm rain coat (if it's moderate), or bring an umbrella (if it's warm) Note: you can decide how to define your temperature ranges. Note: if you need to compare text values (Strings), you can use an expression like this, which returns a boolean: userString.equalsIgnoreCase(someOtherString) Additional Coding Requirements  choose the conditional structure that is a good logical match for the task write your conditional in a way that reduces duplicated or repeated code use constants when appropriate (for example, to define your temperature ranges) follow Java naming conventions for variables (lower camel case with no underscores)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a complete program to give advice on clothing/accessories based on the weather. Your program should accomplish these steps, in order:

Part One: User Input 

  1. ask the user what the temperature is and read in that value
  2. ask the user if there is precipitation (i.e., rain or snow)
    • you can decide how to phrase that question and what to read in

Part Two: Weather Advice Output 

  1. display information about the precipitation based on these rules:
    • if there is no precipitation, tell the user that is dry 
    • if there is precipitation, use the temperature to tell the user if it is raining or snowing
  2. display advice to the user about what to wear, following these rules
    • if it is very cold, wear a heavy coat; if it's moderate, wear a light coat
    • if there is precipitation: wear a hat (if it's very cold), wear a warm rain coat (if it's moderate), or bring an umbrella (if it's warm)

Note: you can decide how to define your temperature ranges.

Note: if you need to compare text values (Strings), you can use an expression like this, which returns a boolean:

userString.equalsIgnoreCase(someOtherString)

Additional Coding Requirements 

  • choose the conditional structure that is a good logical match for the task
  • write your conditional in a way that reduces duplicated or repeated code
  • use constants when appropriate (for example, to define your temperature ranges)
  • follow Java naming conventions for variables (lower camel case with no underscores)
Expert Solution
Algorithm
  1. Ask the user for the temperature and precipitation.
  2. Determine if it is raining or snowing based on the precipitation input.
  3. If it is dry, provide advice based on temperature:
    • If temperature is very cold, wear a heavy coat.
    • If temperature is moderate, wear a light coat.
    • If temperature is warm, wear something comfortable.
  4. If it is raining or snowing, provide advice based on temperature:
    • If temperature is very cold, wear a heavy coat and a warm rain coat.
    • If temperature is moderate, wear a light coat and a warm rain coat.
    • If temperature is warm, bring an umbrella and a light rain coat.
  5. Display the appropriate weather advice to the user.
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education