View the step-by-step solution to:

Question

Im trying to create program that will tell me what my lucky number is, based on my name and

birthday.

  1. Using jGRASP, and write Java program VimahiChris.java, using my last name and my first name, that does the following:

Ask the user for their first name.

Ask the user for their last name.

Ask the user for the year they were born in.

Ask the user for the month they were born in.

Ask the user for the date they were born on.

Generate a lucky number for the user by doing the following:

Count how many characters are in the user's first name, then in the user's last name. Raise the first number to the power of the second number - in other words, find (number chars in first name)^(number chars in last name). Divide this number by the year they were born.

Compare the month and the date of the user's birthday. Find which number is larger. Divide the year they were born in by this number.

Compare the two numbers from the last two steps to find which number is lower and which is higher. Use this information to set the low and high ends of a range.

Generate a random number within the range you have created.



Example: My name is Chris Vimahi, born on 5-9-1992. First name has 5 characters, last name has 6 characters - so I will find 5 to the 6th power then divide this number by the year born in: 5^6 / 1906 = 15625 / 1992 = 8. Then I'll compare the month (5) and day (9) - the larger number is 12, so I'll divide the year 1992 by 12: 1992 / 12 = 166. I'll compare the two numbers to see what is my lower number and what is my higher number, then I can have the low and high ends of my range: 8 and 166. Now I will generate a random number between 8 and 166.

Top Answer

Approach to solve the given problem statement First, enter all the required parameters. Then apply mathematical operations... View the full answer

10.PNG

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question