Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Videos

Question
Book Icon
Chapter 8, Problem 11PE
Program Plan Intro

Cooling and heating degree-days

Program Plan:

  • Declare a main function. Inside the main function,
    • Declare and assign the value for the variables.
    • If the condition is true, enter the loop,
      • Get the input from the user.
      • If the user enters “exit”, then break the loop.
      • Otherwise, in try block,
        • Set the value
        • Check “avgTemp” is less than 60
          • Calculate the “coolDeg” value.
        • Check “avgTemp” is greater than 80
          • Calculate the “heatDeg” value.
        • Assign the value to the “avgTemp”.
      • In exception block, throw an error message.
    • Display an output.
  • Call the main function.

Blurred answer
Students have asked these similar questions
Assignment Write a program that tracks how much steps the user walks in total in a day and reports if the daily target is reached or not. The program will keep reading double values, each representing steps walked during an individual activity within a day (stepsWalked) until either the user enters a negative value or the daily target of 5000 steps is met. If the user enters a negative number, the program should print total steps walked as a double. Otherwise, if the target is exactly reached, the program should simply print "Target is reached", finally if the target is surpassed the program should print the text "Target is surpassed by", followed by the excess amount above the target as a double, and finally printing the text "steps". NOTE: You MUST use a repetitive statement in this question. NOTE: Each stepsWalked value will be given as a non-negative value. You do NOT need to check this. Input Output Answer assignment 3000 1300 500 2305.2 Target is surpassed by 2105.2 steps 450…
MATLAB QUESTION - As of 2018, the population of "A city" is 646 thousand and the population of "B city" is 269 thousand. While the population of "A city" decreases by 7.1% every year, the population of "B city" increases by 12.9%. According to this information, write a program that calculates the year in which the population of "B city" passed the population of "A city".
A mail order house sells five different products whose product numbers and retail prices are: product 1 - $2.98, product 2 - $4.50, product 3 - $9.98, product 4 - $4.49, product 5 - $6.87. Write a program that reads a series of pairs of numbers (from user). That is, each time it reads the pairs of values as follows: i) product number ii) quantity of that product sold Your program should use a switch statement to determine the retail price for each product. Your program should calculate and display the total retail value of all products sold. Use a sentinel-controlled while loop so user can indicate when the program should stop looping and display the final results.
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Program to find HCF & LCM of two numbers in C | #6 Coding Bytes; Author: FACE Prep;https://www.youtube.com/watch?v=mZA3cdalYN4;License: Standard YouTube License, CC-BY