Submit the source code .java file(s) on Ecampus. It's o.k. to combine the three
questions into one compilable java file.
1. Create a program named
sign.java. Ask the user which month and day they were born. Output
their birthstone and zodiac sign. You should have these two methods in
your program:
String Birthstone(int Month)
String ZodiacSign(int Month, int Day)
Example output:
What month were you
born (1-12)? 5
What day of the month were you born? 21
Your birthstone is Emerald.
Your zodiac sign is Gemini.
Challenge: Include the
Chinese zodiac animal. This requires you ask ask the user for the year they were born.
2. Create a program named board.java.
Create a 10x10 two dimensional array of characters. Fill all 100 elements
with a period. Next, fill ten random elements with a plus symbol. Place your last name
initial in a random location. Output the array using a nested for loop in
this format:
. . . + . . . . . .
. . . . . . . . . .
. . . + . . . . . .
. . . . . . . . + .
. . K . . . . . . +
. . . . . + . . . .
. + . . . . . . . .
. . . . . . + . . .
. . . . . . . . . +
. +
+ . . . . . . .
3. Create a program named roman.java. Ask the user to enter a Roman
Numeral. Output the numeric value of the Roman
Numeral. You should have the following method in your program:
int RomanToDecimal(String R)
Here's some numbers to test your program with: MCMXLII
= 1942,
MCMLXIX = 1969, DCCCLXXXVIII = 888
Hint: In the
RomanToDecimal method, create a for loop that steps through each character of
roman numeral.
M = 1000, D = 500, C = 100, L = 50, X = 10, V = 5, I = 1.
MDCLXVI = 1000 + 500 + 100 + 50 + 10 + 5 + 1 = 1666
If a digit is out of order, then it is subtracted from the next digit.
This is only used for these combinations:
CM = 900, CD = 400, XC = 90, XL = 40, IX = 9, IV = 4