• Log in or sign up for an account here: https://www.sythe.org/login

Java Homework Assignment

blahnoobz

Active Member

$5 USD Donor New
Joined
Jul 16, 2011
Sythe Gold
0
Messages
184
Location
Southern California
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 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
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?
 
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?

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;
     }
}
 
Runescape Gamblingrunescape gambling
Back
Top