View the step-by-step solution to:

// ********************************************************** // Temps.

// **********************************************************
// Temps.java
//
// This program reads in a sequence of hourly temperature
// readings (beginning with midnight) and prints the maximum
// temperature (along with the hour, on a 24-hour clock, it
// occurred) and the minimum temperature (along with the hour
// it occurred).
// **********************************************************

import java.util.Scanner;

public class Temps
{
//----------------------------------------------------
// Reads in a sequence of temperatures and finds the
// maximum and minimum read in.
//----------------------------------------------------
public static void main (String[] args)
{
final int HOURS_PER_DAY = 24;

int temp; // a temperature reading

Scanner scan = new Scanner(System.in);

// print program heading
System.out.println ();
System.out.println ("Temperature Readings for 24 Hour Period");
System.out.println ();

int hour = 0;

while (hour < HOURS_PER_DAY)
{
System.out.print ("Enter the temperature reading at "
+ hour + " hours: ");
temp = scan.nextInt();
hour++;
}

// Print the results
}
}

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question