Question: Need help with Java assignment compliation. Please help!! Program 3A: Birthstones by Month US 2016 Write a Java program that gives the names of birthstones
Need help with Java assignment compliation. Please help!!
Program 3A: Birthstones by Month US 2016
Write a Java program that gives the names of birthstones according to month. You will read in a birth month as a number from 1 to 12. You will output the name of the corresponding birthstone from the list of US 2016 birthstones from the Wikipedia article called Birthstone that is included near the end of this assignment. For the months that have more than one birthstone, you will output the name of only the first birthstone. Make screen shots of your output and paste them into a Word document. Zip the Word document and your .java source file together and turn in that one zipped file.
3. Use comments liberally to document exactly what you are doing in the program.
4. Use descriptive variable names in camel-case with the first letter in lowercase.
5. Ask the user for their birth month as an integer from 1 to 12.
6. Read in an integer and assign it to a variable of type integer.
7. At this point, try to compile and run your program. Dont move on until this part is working. You wont see any output at this point unless you put in a temporary print statement to see the month.
8. Use nested if-else statements or a switch statement to determine which birthstone (a switch statement is cleaner and will receive Extra Credit points). Be sure just to use the first two in the beginning; get that working, and only then go back and enter the others. If you use a nested if-else statement, you MUST format it nice and neat like (b) in Figure 3.3 (p. 82 in my book), NOT like (a) where it is strung across the page with a bunch of indentions.
9. Put a print statement after each if or case statement to print a sentence which states something like: Your birthstone is amethyst. but substitute whatever that months birthstone is. OR you can declare a String that will contain the name of the birthstone above the if statements and set that variable after the if statement instead of putting a print for each one, and then you would put a single print after all the if statements or after the switch statement. The second method is cleaner and preferable, but we havent studied String type yet. (When I say print statement, I mean any of the various types of print statements: print, printf, println; printf is discussed in 4.6.)
10. Remember to use an else statement with a group of else ifs or a default: statement with a switch to catch all the other things and print That is an invalid month number. You must enter 1-12. Also remember that with a default: statement, you need to use a break; with your last case. It is always good form to use break; even when its not required.
11. Make screen shots of your output and paste them into a Word document. Zip the Word document and your .java source file together and turn in that one zipped file. Sample Run: Please enter your birth month as a number (example, December would be 12): 2 Your birthstone is amethyst.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
