Question: Using C# This program will be used to record temperatures that the user enters. There is a button for the user to open a new

Using C#

This program will be used to record temperatures that the user enters. There is a button for the user to open a new dialog and enter a new temperature. The program will automatically display the most recently added temperature, as well as the average of all the temperatures added. Lastly, the user can save the temperatures in a file.

To do this, complete the following steps:

  1. When the user clicks the Add New Temperature button on Form1, display the AddTempForm (already created for you, though youll need to add code).
    1. When the user enters a valid temperature and clicks OK, the dialog should close and keep track of the new temperature.
    2. When the user clicks Cancel, the dialog should close and not add the temperature.
    3. A temperature is valid if it is an integer between -30 and 130. Use a Validating event to verify whether information is valid. You do not need to display an error message. If it is not valid, nothing should happen when the user clicks OK. The user should be able to click Cancel, even if the temperature is not valid.
  2. If the user adds a new temperature, add the new temperature to the tempList (the list has already been created for you).
    1. Display the temperature in lblMostRecentTemp.
    2. Calculate the new average of all temperatures.
  3. If the user clicks Save Temperatures, display a FileSaveDialog to let the user choose where to save the file. Use a filter in the dialog that allows them choose whether to see Text Files (.txt) or all files (any extension).
    1. If the user clicks Save, write the list of temperatures to the file the user selected, with one temperature on each line.
    2. If the user cancels the File Save dialog, you should not save the file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!