Java Homework Assignment

Discussion in 'Programming General' started by blahnoobz, Sep 29, 2011.

Java Homework Assignment
  1. Unread #1 - Sep 29, 2011 at 8:39 PM
  2. blahnoobz
    Joined:
    Jul 16, 2011
    Posts:
    184
    Referrals:
    1
    Sythe Gold:
    0

    blahnoobz Active Member
    $5 USD Donor New

    Java Homework Assignment

    Below is the work we have to do. The output should be a JOptionPane window. I am just not sure where to start. If someone can do a majority/small part of code to get me started that would be great, I am confused and not sure what to do. What we are suppose to do is ask the gemstone and then output it but I am not sure on how to go about that for the certain gemstone each time. Thank you if you can help!



    import /* you should know this by now*/

    public class Gemstones
    {
    public static void main(String[] args)
    {
    String month = getUserMonth();

    //call method displayGemstone
    }

    //write both methods: getUserMonth & displayGemstone
    }





    Lab 3A
    class GemStones
    Ask the user what his/her birth month is.
    Tell them what their birthstone is using if else statements.
    January Garnet
    Carnation,
    Snowdrop
    Constancy
    February Amethyst Violet, Primrose Sincerity
    March
    Bloodstone,
    Aquamarine
    Jonquil,
    Daffodil
    Wisdom
    April Diamond
    Sweet pea,
    Daisy
    Innocence
    May Emerald
    Lily of Valley,
    Hawthorn
    Love
    June
    Pearl,
    Moonstone,
    Alexandrite
    Rose,
    Honeysuckle
    Wealth
    July Ruby
    Larkspur, Water
    Lilly
    Freedom
    August
    Sardonyx,
    Peridot
    Poppy, Gladiola Friendship
    September Sapphire
    Aster, Morning
    Glory
    Truth
    October Opal
    Calendula,
    Cosmos
    Hope
    November Topaz Chrysanthemum Loyalty
    December
    Turquoise,
    Zircon
    Rubric:
    Score Product
    I Compiles and shows some knowledge of decisions
    II Some months work
    III Works as directed for user input of numbers to represent months.
    IV Works as directed for user input of words to represent months.
    V Works as directed for user input of numbers or words to represent months.
    VI ? Works as directed for user input of numbers or words, regardless of case, or
    three letter month abbreviations to represent months.
     
  3. Unread #2 - Sep 30, 2011 at 4:47 PM
  4. SuF
    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary

    SuF Legend
    Pirate Retired Global Moderator

    Java Homework Assignment

    PHP:
    import /* you should know this by now*/

    public class Gemstones
    {
         public static 
    void main(String[] args)
         {
              
    String month getUserMonth();

              
    displayGemstone(month);
         }

         
    //write both methods: getUserMonth & displayGemstone

         
    public static displayGemstone(String month)
         {
         
    //code to display gemstone
         
    }
         public static 
    getUserMonth()
         {
         
    //get input
         
    }
    }
    That should get you started. You just need to fill in the two methods. Do you have any clue what you have to do for those?
     
  5. Unread #3 - Dec 31, 2011 at 3:57 PM
  6. Sabar
    Joined:
    Dec 31, 2011
    Posts:
    64
    Referrals:
    0
    Sythe Gold:
    0

    Sabar Member
    Banned

    Java Homework Assignment

    nope but thanks
     
  7. Unread #4 - Dec 31, 2011 at 5:21 PM
  8. iJava
    Joined:
    Nov 21, 2011
    Posts:
    1,197
    Referrals:
    11
    Sythe Gold:
    485
    Discord Unique ID:
    220055593568829441

    iJava .Previously known as RSGoldRush
    $200 USD Donor New

    Java Homework Assignment

    To elaborate on this code by SuF :


    PHP:
    import /* you should know this by now*/

    public class Gemstones
    {
         public static 
    void main(String[] args)
         {
              
    String month getUserMonth();

              
    displayGemstone(month);
         }

         
    //write both methods: getUserMonth & displayGemstone

         
    public static displayGemstone(String month)
         {
          
    String monthLC month.toLowerCase();
         if(
    monthLC == jan || monthLC == january) {
                
    //Display Jan Gemstone here
                
    }
         }
         public static 
    getUserMonth()
         {
         
    //Use a scanner to gather input and store in a String called userMonth
          
    String userMonthLC userMonth.toLowerCase();
          return 
    userMonthLC;
         }
    }
     
< Script Editor? | Matching colours with coodinates >

Users viewing this thread
1 guest


 
 
Adblock breaks this site