logo

Temperature Recording Program: Java Implementation for Daily and Weekly Temperature Tracking

   

Added on  2023-04-25

7 Pages1100 Words494 Views
Running head: TEMPERATURE RECORDING PROGRAM
Temperature Recording Program
Name of the Student:
Name of the Author:
Author note:
Temperature Recording Program: Java Implementation for Daily and Weekly Temperature Tracking_1
2
TEMPERATURE RECORDING PROGRAM
Table of Contents
Introduction................................................................................................................................3
Pseudo Code...............................................................................................................................3
Source Code...............................................................................................................................4
Output Screenshots.....................................................................................................................5
Reflection Questions..................................................................................................................6
Conclusion..................................................................................................................................7
Temperature Recording Program: Java Implementation for Daily and Weekly Temperature Tracking_2
3
TEMPERATURE RECORDING PROGRAM
Introduction
The program is meant to record the average daily temperature for each of the days of
a week. The program has been coded using the Java programming language. In this program,
the days are stored in an ArrayList data structure in java. The data type of this ArrayList is set
as String. Furthermore, another Double data-type ArrayList is used to store the respective
temperature for each day. Both arrays are set to be of capacity of 7. The user is asked to
search for the temperature of a particular day or the temperature stats for the whole week.
The weekly stat also provides the week’s average temperature, having calculated the same
from the program’s dataset.
Pseudo Code
Step-1. Initialize String arrayList for days
Step-2. Initialize String arrayList for temperature
Step-3. Add all days from Monday to Sunday into days array
Step-4. Add all temperatures as per respective days from Monday to Sunday into
temp array
Step-5. Display menu
Step-6. Take user input of choice
Step-7. Set Flag=0, sum=0
Step-8. Check if choice is Week, if yes goto next step, else goto
Step-9. For each temperature data in Temp array follow the below two steps 10 and 11
Step-10. Add the temperature to Sum
Step-11. Display the temperature and the corresponding day from the Days array.
Step-12. Divide Sum by 7 to get average and display the average weekly temperature
and goto Exit step.
Temperature Recording Program: Java Implementation for Daily and Weekly Temperature Tracking_3

End of preview

Want to access all the pages? Upload your documents or become a member.