
Concept explainers
write a java program that ask user for input and produce output like January 31, 2023.
that accept any integer between 1 and 12 as first input, any integer between 1 and 31 as the second input, and any integer between 1 and 99 as the theird input.
The inputted numbers must be inside the eligible ranges. E.g., if the user inputs 15 as the first number, the
program must generate the corresponding error message.
The number of eligible days must depend on the month. E.g., the second input of 31 is not eligible if the first input was 4 (April).
If the inputted year is a leap, the number of eligible days in February must be 29.
instead of stopping after the wrong input, your program must request the new input until the correct one is provided.
the execution should look like this:
Enter a day from 1 to 29: 12
Enter a year from 1 to 99: 10
February 12, 2010.
More? (Y/N) Y
Enter a month from 1 to 12: 1
Enter a day from 1 to 31: 1
Enter a year from 1 to 99: 0
Invalid year. Enter a year from 1 to 99: 1
January 1, 2001.
Enter a month from 1 to 12: 31
Invalid month. Enter a month from 1 to 12: 2
Enter a day from 1 to 29: 29
* We will check for a leap year in the next step *
Enter a year from 1 to 99: 23
Not a leap year. So, enter a new day from 1 to 28: 28
February 28, 2023.
More? (Y/N) N

Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images

- In Java.arrow_forwardA patient suffering from asthma needs to keep a diary of their “peak flow” breathingreadings. This is just a number between 0 and 800 measuring how well they canblow air from their lungs. Their peak flow reading is the greatest of three readingstaken at one time. Write a Java procedural program to help the patient record their peak flow to show theirdoctor. The program should first ask the patient for the number their doctor has given themas being a dangerous reading. Any peak flow reading recorded that is less than thedanger level should lead to a message that they need to go to hospital immediately.Once entered, this value should not be changed.After storing this number, the program should go into a loop that only stops whenthey type 0 instead of a day. It should repeatedly ask them for the day of the monthwhich is a number from 1 to 31 (they may skip days) and then the three readingstaken that day. All the peak flow readings (ie the largest of each set of threereadings) should be…arrow_forwardWrite a program that reads an arbitrary number of integers that are in the range -25 to 25 inclusive and counts how many occurences of each are entered. Indicate the end of the input by a value outside of the range. After all input has been processed, print all of the values (with the number of occurences) that were entered one or more times.arrow_forward
- Write a FULL Java procedural program for a simple word guessing game. Below is an example of the required program behaviour. The bold text is user keyboard input. The player is allowed to guess one letter or the whole word incorrectly up to 5 times; each incorrect guess is called a “strike”. The program starts by displaying one full stop (’.’) for each character of the secret word. You may assume the word is hardcoded into the game, is in lower case, and is of length greater than one. In each round of the game, the game first checks if the player has reached the maxinum number of strikes; if so, the player loses and the game ends. If not, the game prints an input prompt. The player then guesses either one letter (by entering a single character) or the whole word (by entering multiple characters). If a single letter is guessed correctly, meaning the character occurs in the word, the game reveals the positions of those occurrences in the word and proceeds to the next round. If the whole…arrow_forwardWrite a program that mimics a calculator. The program should take as input two integers and the operation to be performed. It should then output the numbers, the operator, and the result. For division, if the denominator is zero, output an appropriate message. Limit the supported operations to + -/ *and write an error message if the operator is not one of the supported operations. Here is some example output: 3 + 4 = 7 13 * 5 = 65 C++arrow_forwardWrite a Java program correctly that will prompt for and read 3 integer values guests, tables, and meals entered by the user. Determine the message(s) to display based on the specifications that follow. Note, there can be more than one category the user input satisfies. Be sure to use the same format and wording as in the sample runs in the table below.Using a combination of at most 3 if, else if or else to fulfill the requirements described below.1. If the number of meals is greater than the number of tables and the number of guests is smaller than the number of meals, display Seems all guests will be served.2. If the number of guests is greater than the number of tables and the number of meals is smaller than number ofguests display the message Seems that not all the guests will be served.3. If the number of guests is smaller than the number of meals and the number of tables is greater than the number of meals, display the message Seems that some tables will be empty.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





