1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
spin [16.1K]
3 years ago
7

Write an application named DailyTemps that continuously prompts a user for a series of daily high temperatures until the user en

ters a sentinel value of 999. Valid temperatures range from -20 through 130 Fahrenheit. When the user enters a valid temperature, add it to a total; when the user enters an invalid temperature, display the error message:
Computers and Technology
1 answer:
KatRina [158]3 years ago
5 0

Answer:

import java.util.Scanner;

public class DailyTemps

{

public static void main(String[] args) {

   

    int total = 0, count = 0;

    double avg = 0;

   

    Scanner input = new Scanner(System.in);

    System.out.print("Enter a temprature: ");

    double temperature = input.nextDouble();

   

    while(temperature != 999) {

       

        if (temperature >= -20 && temperature <= 130) {

            total += temperature;

            count ++;

        }

        else

            System.out.println("Invalid Input!");

       

       System.out.print("Enter a temprature: ");

       temperature = input.nextDouble();

    }

   

    avg = total / (double)count;

    System.out.printf("The average of " + count + " temperature is: %.2f", avg);

}

}

Explanation:

- Initialize the variables

- Ask the user for the temperature

- Initialize the while loop that iterates until the user enters 999

- Check temperature if it is between -20 and 130, if yes, add it to the total and increment the count by 1. If it is not between the interval, print an error message

- Keep asking the temperature

-  Calculate and print the average of the temperatures

You might be interested in
You would like the word "Employee" to appear in cells A1, B1, C1, D1, and E1. To be efficient, you should
Agata [3.3K]

Answer: type the label in A1 and use autofill

Explanation:

Took the final 2021 Edgeunity

6 0
3 years ago
Modern fax machines use _______ to transmit text.
KatRina [158]
Modern fax machines use senors to transmit text.
hope this helps:)
3 0
4 years ago
Read 2 more answers
Programming: Write a recursive function to_number that forms the integer sum of all digit characters in a string. For example, t
scZoUnD [109]

yes

Explanation:

isn't really noted but if the sequence is in the given order the ("3at4") could be expressed in a ('0' to '9' )format

7 0
3 years ago
What is the molecular activity of mattern
pav-90 [236]

Matter is made up of extremely tiny particles called atoms and molecules. Atoms and molecules make up the three common states of matter on Earth—solids, liquids, and gases. The particles of a liquid are attracted to one another, are in motion, and are able to move past one another.

<em>-</em><em> </em><em>BRAINLIEST</em><em> answerer</em>

7 0
3 years ago
Read 2 more answers
_____________ is the process of inspecting data that has been input to a program to make sure it is valid before it is used in a
Maksim231197 [3]

Answer: E) Input validation

              C) Data validation

Explanation:

  • Input validation is the process of analyzing and testing input's quality and correctness that are being processed at further level in information system.It help in eliminating any type of improper or informal input data from getting supplied to user or program in a system.
  • Input validation is also known as data validation.As the input that is being tested and validated is form of data that is going through cleansing task to remove useless data.
  • According to the question, data and input are being inspected to extract the validity and correctness of it before sending it for computation .Thus , both data and input validation is happening in this case.
  • Other options are incorrect because testing is examining the data.Correction data and input is the step for rectifying the mistakes in data or input.
  • Thus, the correct option is option(C) and (E).

4 0
4 years ago
Other questions:
  • Which best describes the difference between stocks and bonds ?
    8·2 answers
  • Where can you access all the formatting options for worksheet cells?
    5·1 answer
  • Which command on the page layout ribbon enables a user to mark where a new page will begin on the printed copy?
    6·1 answer
  • What are the three aspects to consider when taking and critiquing photograph?
    9·1 answer
  • The proper hand position for keyboarding.
    15·1 answer
  • Suppose we are sorting an array of eight integers using quicksort, and we have just finished the first partitioning with the arr
    6·1 answer
  • What is one reason that writing effective messages is so important
    11·2 answers
  • What gaming PC should I get
    14·2 answers
  • If an electric circuit has 30ohms and 10amps. How many volts the battery voltmeter should read?
    10·1 answer
  • When working in outline mode, press __________ and click the eye icon to change only one layer back to preview mode.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!