Write a Java class to process a collection of 12 daily temperatures. Your program should prompt the user to enter the 12 daily temperatures and then the temperatures stored in an array .The program should then count and print the number of hot days (temperature 38 or higher), and the number of pleasant days (temperatures less than 38), it should also display the category of each temperature. First of all you will need to create a class diagram using MS Visio for this class showing its attributes as well as the operations and then write a pseudocode in the space provided.
so far i've put together this.
1.0 GET 12 daily temperatures
1.1. STORE daily temperatures
LOOP UNTIL 12
2.0 Count AND PRINT days 38> and category (hot days)
2.1 THEN PRINT days <38 and category (pleasant days)
this is pretty basic, but im really new to java and struggling!
Looks pretty good ... it's rare for somebody to start with pseudo code .... always do that... good habit.
My question here would be: how do you know what day has which temperature? Are you planning capturing the day and the temperature? If yes, what do you think you could use ?
it basically has to display how many days are cold and how many days are hot.
any ideas how the code would look? :S confused
hashtable & 2D array
So I'm assuming that you need both the name of the day and the temperature. What first comes to mind is to use a habletable, although a 2D array could probably also work.
Hashtable (Java 2 Platform SE v1.4.2)
Java Hashtable Example