1. Create a program named sign.java. Ask the user which month and day they were born....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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? 28 Your birthstone is Emerald. Your zodiac sign is Gemini. Extra Credit: Include the Chinese zodiac animal. This requires you ask ask the user for the day of the month 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 dollar sign. Place your last name initial in a random location. Output the array using a nested for loop in this format: 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 Roman ToDecimal 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 import java.util.*; public class Test { public static void main(String[] args) { Scanner in = new Scanner (System.in); Program 1 month were you born? (1-12) "); // program 1 System.out.println(" System.out.print("What int Month= in.nextInt(0); System.out.print("What int Day = in.nextInt(); day of the month were you born? "); System.out.println("Your birthstone is " + Birthstone(Month)); } static String Birthstone(int Month) { String[] Stones = {""", "garnet", "amethyst", "aquamarine"}; return Stones[Month]; } static String ZodiacSign(int Month, int Day) { } if (Month == 3 && Day>= 21) || (Month==4 && Day<=19)) return "Aries"; return"""; // program 2 System.out.println("~~~~ Program 2 char[][] world = new char[10][10]; // initialize world to periods for (int y=0; y<10; y++) { for (int x=0; x<10; x++) { world[x][y] =!!; } } } // add 10 dollar signs in random locations world[ (int) (Math.random()*10) ][ (int) (Math.random()*10)] = 's'; world [ (int) (Math.random()* 10) ][ (int) (Math.random() * 10) ] = "W"; // Print world for (int y=0; y<10; y++) { for (int x=0; x<10; x++) { System.out.print(world[x][y] + " "); System.out.println(); // Add a new line after each row } // program 3 System.out.println(" System.out.print("Enter a Roman Numeral: "); in.nextLine();//fixes skipping String input String = in.nextLine(); System.out.println("Converted to Decimanl is * + Roman ToDecimal(RomanNum)); } static int Roman ToDecimal(String Roman) { } int Decimal = 0; for (int i = 0; i < Roman.length(); i++) Program 3 { if (Roman.charAt() == 'i') Decimal += 1; else if (Roman.charAt(i) == 'V') Decimal -= 2; return Decimal; ~"); 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? 28 Your birthstone is Emerald. Your zodiac sign is Gemini. Extra Credit: Include the Chinese zodiac animal. This requires you ask ask the user for the day of the month 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 dollar sign. Place your last name initial in a random location. Output the array using a nested for loop in this format: 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 Roman ToDecimal 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 import java.util.*; public class Test { public static void main(String[] args) { Scanner in = new Scanner (System.in); Program 1 month were you born? (1-12) "); // program 1 System.out.println(" System.out.print("What int Month= in.nextInt(0); System.out.print("What int Day = in.nextInt(); day of the month were you born? "); System.out.println("Your birthstone is " + Birthstone(Month)); } static String Birthstone(int Month) { String[] Stones = {""", "garnet", "amethyst", "aquamarine"}; return Stones[Month]; } static String ZodiacSign(int Month, int Day) { } if (Month == 3 && Day>= 21) || (Month==4 && Day<=19)) return "Aries"; return"""; // program 2 System.out.println("~~~~ Program 2 char[][] world = new char[10][10]; // initialize world to periods for (int y=0; y<10; y++) { for (int x=0; x<10; x++) { world[x][y] =!!; } } } // add 10 dollar signs in random locations world[ (int) (Math.random()*10) ][ (int) (Math.random()*10)] = 's'; world [ (int) (Math.random()* 10) ][ (int) (Math.random() * 10) ] = "W"; // Print world for (int y=0; y<10; y++) { for (int x=0; x<10; x++) { System.out.print(world[x][y] + " "); System.out.println(); // Add a new line after each row } // program 3 System.out.println(" System.out.print("Enter a Roman Numeral: "); in.nextLine();//fixes skipping String input String = in.nextLine(); System.out.println("Converted to Decimanl is * + Roman ToDecimal(RomanNum)); } static int Roman ToDecimal(String Roman) { } int Decimal = 0; for (int i = 0; i < Roman.length(); i++) Program 3 { if (Roman.charAt() == 'i') Decimal += 1; else if (Roman.charAt(i) == 'V') Decimal -= 2; return Decimal; ~");
Expert Answer:
Answer rating: 100% (QA)
java import javautilScanner public class sign public static void mainString args ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Problem 2 Consider the hydraulic tank system with inertance and hose compliance shown below. P P= hose h R: grove A P = 0 The hose has length L, cross-sectional area a, and its compliance is...
-
If a consumer loan is to be assigned to a new company, how many days 1 point prior to transfer must the consumer be informed?
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
Discuss three quotes from the YouTube video (put time stamps after you type the quote) and explain why chose this quote. https://youtu.be/h86MGjGAtYk?si=_1hMyOefl0L3E4ox Example: Radio is "still...
-
The results of activity measurements on a mixed sample of radioactive elements are given in the table.(a) How many different nuclides are present in the mixture?(b) What are their half-lives?(c) How...
-
In baseball, a players batting average is the proportion of times the player gets a hit out of his total number of times at bat. The distribution of batting averages in a recent season for Major...
-
Public Expenditure on Education Figure 2.27 shows the public expenditure on education as percentage of Gross Domestic Product (GDP) for all countries. The mean expenditure is $\mu=4.7 %$ and the...
-
Evaluate the following statement made by an auditor: "On every aspect of the audit where it is possible, I calculate the point estimate of the misstatements and evaluate whether the amount is...
-
Image transcription text Course Project Overview Guidelines 1. Legibly write on each piece of paper V Your first and last names V The course and section number The assignment title The page number 2....
-
1. This family business has made numerous transitions. It started as two brothers and their wives (Whitehall), then became a husband and wife team (Judds Hill), and finally parents with their son and...
-
5. Suppose the Black-Scholes framework holds. A non-dividend-paying stock is now selling for x > 0. The volatility of the stock is o per annum. The interest rate is r per annum with continuous...
-
An office building which generates $260,000 in Net Operating Income is advertised for sale at a price of $3,250,000. After meeting with your lender they offer agreed to originate a loan of $2,600,000...
-
What is risk? What is/are the implication/s of risk to the set goals of a Business organization? Scan your environment, present a potential risk that is detrimental to anybody or anything. Provide a...
-
Calculate annual NOI for a 40,000 sq. Ft. Warehouse that rents for $0.35 per sq. ft./mo. Vacancies and collection losses are 7%. The property insurance cost is $0.11 per sq. ft./year, maintenance...
-
Suppose you observe the situation in the table below. What is the expected return of a portfolio with 40% stock A and 60% stock B? Return if State Occurs State of Economy Probability of State Stock A...
-
An investor puts together the following portfolio: The investor deposits $1000 into a 1-year CD that pays i = 2.1%. The investor writes a put option on TomCo stock, agreeing to sell 100 shares at the...
-
Consider the following hypothetical aqueousreaction: A(aq)B(aq). A flask is charged with0.065 mol of A in a total volume of100.0 mL. The following data are collected: Time (min) 0 10 20 30 40 Moles...
-
Calculate I, , and a for a 0.0175 m solution of Na 3 PO 4 at 298 K. Assume complete dissociation. How confident are you that your calculated results will agree with experimental results?
-
Marty is a sales consultant. Marty incurs the following expenses related to entertainment of his clients in 2012: Dues to a country club......................................................$4,500...
-
Linda and Richard are married and file a joint return for 2012. During the year, Linda, who works as an accountant for a national airline, used $2,100 worth of free passes for travel on the airline;...
-
Leslie is a single taxpayer who is under age 65 and in good health. For 2012, she has a salary of $23,000 and itemized deductions of $1,000. Leslie is entitled to one exemption on her tax return. a....
-
You shoot a beam of electrons through a double slit to make an interference pattern. After noting the properties of the pattern, you then double the speed of the electrons. What effect would this...
-
How many photons does a \(5.0 \mathrm{~mW}\) helium-neon laser \((\lambda=633 \mathrm{~nm})\) emit in 1 second? A. \(1.2 \times 10^{19}\) B. \(4.0 \times 10^{18}\) C. \(8.0 \times 10^{16}\) D. \(1.6...
-
Light consisting of \(2.7 \mathrm{eV}\) photons is incident on a piece of potassium, which has a work function of \(2.3 \mathrm{eV}\). What is the maximum kinetic energy of the ejected electrons? A....
Study smarter with the SolutionInn App