Results 1 to 4 of 4

Thread: helpp lol

  1. #1
    ryzii is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default helpp lol

    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.
    START LOOP
    INPUT
    1.0 GET 12 daily temperatures
    1.1. STORE daily temperatures
    LOOP UNTIL 12
    OUTPUT
    2.0 Count AND PRINT days 38> and category (hot days)
    2.1 THEN PRINT days <38 and category (pleasant days)
    END LOOP

    this is pretty basic, but im really new to java and struggling!

    ryan

  2. #2
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default

    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 ?

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  3. #3
    ryzii is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default

    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

  4. #4
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default 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:
    Hashtable (Java 2 Platform SE v1.4.2)
    Example:
    Java Hashtable Example

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •