Question: You will write a program that plays a word game with the user. You need to use the scanner class to get the input from
You will write a program that plays a word game with the user. You need to use the scanner class to get the input from the user
Your program must produce the output shown in the box below.
The values shown in bold italics are user inputs and will be whatever the user types in at the keyboard or dialog box when the program is executed.
You must write a method to calculate the day for the Easter for the given year, therefore the method will be
public static int easterDay(int year)
{
int day =0;
//your code to calculate the day of easter return day;
}
OUTPUT will look something like this:
Report produced by Your name goes here
********************************************************************************************************************************
| Hi, what is your name? Barbara In what year were you born? 1982
OH you were born in 82!!! OH, I'm sorry Barbara, how rude of me! Let me introduce myself. This is your computer speaking.
I need a good sounding name. What do you think would be a good name for me? Mr. Data Cruncher Oh, Mr. Data Cruncher hmmm... that's good! Please, let me start over.
Hello Barbara, let me introduce myself. I am Cruncher, your computer. You can also call me Data
Barbara, you know what? I can tell you what day Easter will be on for any year (on the Gregorian calendar) from 1900 to 2099.
In 1982, the year you were born, Easter was on 4/11/1982. For what year are you interested in finding out when Easter is? 1950 In 1950 Easter is on 4/11/1950.
Well Barbara, it has been nice talking with you. I am sure we will be spending a lot of time together this semester. I hope you enjoy CSc15. So long for now, have a nice day. ******************************************************************************************************************************** |
It is intended that this program will give you practice using Scanner and formatting output.
For this reason I want you to produce a report that is exactly like the one shown above (except the values of the user input will be different).
You are to produce blank lines where there are blank lines
You will get the following data from the user and store it in appropriate variables.
user's name o user's year of birth o computer's name
the year the user wants to know on what day Easter is
Print the user's responses in the output as shown in the sample output above.
Your program must use good style. Make sure that your lines of code are completely visible in the editor window without having to scroll right and left to see them.
Define a constant to store the current year (2010) and use it where appropriate.
Your program will calculate the date that Easter will be on in the year given by the user then it will print that date to the standard output device (the monitor) in the form mm/dd/yyyy. It should not include any white space when it prints it.
Formula for calculating the date of Easter for any given year (from 1900 to 2099) using the Gregorian Calendar:
h = (24 + 19*(year mod 19)) mod 30 i = h h / 28
j = (year + year/4 + i 13) mod 7 k = i j
The month of Easter = 3 + (k + 40)/44
The day of Easter = k + 28 31*(month/4)
h, i, j, and k are simply used for storing intermediate results in the calculation.
The mod operator ( % ) divides and returns the remainder.
All divisions ( / ) are integer divisions where the remainder is discarded.
You must use good program style with meaningful variable names.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
