Question: Write a complete program to compare the temperatures of three different cities and find the hottest city. First, implement a class called Thermometer as described
Write a complete program to compare the temperatures of three different cities and find the hottest city. First, implement a class called Thermometer as described below:
A. Thermometer has one private data member, temperature of type double.
B. Write code for a constructor to set a data member to the default value of 0.0 .
C. Write code for an accessor method, getTemperature, which returns the value of the appropriate data member.
D. Write code for a mutator method, setTemperature, which has one formal parameter, and store it as the value of the data member.
Then, write a client program to test the Thermometer class defined above. Call this class Temperatures. The main method should perform the following tasks:
E. Allow the user to enter the temperatures of three cities.
F. Declare and create three Thermometer objects setting the instance data member to the values entered by the user.
G. If city 1 is the hottest city among the three cities, output a phrase like "Cityl is the hottest city."
Here is some sample input and output:

Enter the temperature Enter the temperature Enter the temperature Cityl is the hottest city. Enter the temperature of cityl: 76.5 Enter the temperature of city2: 85.2 Enter the temperature of city3: 66.9 City2 is the hottest city. of cityl: 93.4 of city2: 76.1 of city3: 85.8
Step by Step Solution
3.28 Rating (154 Votes )
There are 3 Steps involved in it
Here is the implementation of the Thermometer class and the Temperatures client program in Python py... View full answer
Get step-by-step solutions from verified subject matter experts
