EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
expand_more
expand_more
format_list_bulleted
Question
Chapter 5, Problem 5PE
a.
Program Plan Intro
Display a specified message for the entered date
Program plan:
- Import necessary package.
- Create a class “PastPresentFuture”,
- Define the method “main ()”,
- Declare the necessary variables.
- Create an object for “LocalDate” class.
- Create “Scanner” object.
- Assign the month value returned from the method “getMonthValue()”.
- Assign the day value returned from the method “getDayOfMonth()”.
- Assign the month value returned from the method “getYear()”.
- Prompt the user to enter the month, day, and year.
- Get the month, day and year from the user.
- Check whether the year is a today’s year,
- If it is true, print the related message.
- Otherwise, check whether the month is today’s month,
- If it is true, print the related message.
- Otherwise, check whether the day is same as today,
- If it is true, print the related message.
- Otherwise, print the month related message.
- Define the method “main ()”,
b.
Program Plan Intro
Display a specified message for the entered date
Program plan:
- Import necessary package.
- Create a class “PastPresentFuture2”,
- Define the method “main ()”,
- Declare the necessary variables.
- Create an object for “LocalDate” class.
- Create another instance variable for “LocalDate” class.
- Create “Scanner” object.
- Assign the month value returned from the method “getMonthValue()”.
- Assign the day value returned from the method “getDayOfMonth()”.
- Assign the month value returned from the method “getYear()”.
- Prompt the user to enter the month, day, and year.
- Get the month, day and year from the user.
- Assign the values in a date format.
- Check whether the entered date is a past date,
- If it is true, print the related message that indicates the past date.
- Otherwise, check whether the date is the current date,
- If it is true, print the related message that indicates the current date.
- Otherwise, print the month related message that indicates the future date.
- Define the method “main ()”,
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
java
You must print the number declared double x; on the screen. With which of the following options do you know that a number in the range -9999.99999 to 9999.99999 is printed with exactly 4 decimals and that all numbers in the number are displayed?
Choose an alternative:
a.System.out.format ("%. 4f", x);
b.System.out.format ("% 4.1f", x);
c.System.out.format ("% b", x);
d.System.out.format ("% s", x);
e.System.out.format ("% d", x);
Write an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If the score entered is less than 0 or more than 10, display Score must be between 10 and 0 and do not use the score. After all the scores have been entered, display the number of valid scores entered, the highest score, the lowest score, and the arithmetic average. ***Java please***
Write a program that reads the user's first name and last name, and then use them to create a UPM email for the user.
If the total number of characters in the user's full name, (first name + last name), is less than 10 letters, you should use the full name to create the user’s email.
The general format of the user’s email should look like this:
firstName.lastName@upm.edu.sa For
example:
First name = Ali
Last name = Omar
Total number of letters in both first and last names = 7 letters (<10 letters)
Output = omar.ali@upm.edu.sa
If the number of characters in the user's full name, (first name + last name), is greater than or equal to 10 letters, you should only use the first character in the user’s first name, and the whole last name to create an email.
For example:
First name = Abdullah
Last name = Omar
Total number of letters in both first and last names = 12 letters (>=10 letters)
Output = a.omar@upm.edu.sa Note: you can assume the user will always enter lowercase letters
Chapter 5 Solutions
EBK JAVA PROGRAMMING
Ch. 5 - Prob. 1RQCh. 5 - Prob. 2RQCh. 5 - Prob. 3RQCh. 5 - Prob. 4RQCh. 5 - Prob. 5RQCh. 5 - Prob. 6RQCh. 5 - Prob. 7RQCh. 5 - Prob. 8RQCh. 5 - Prob. 9RQCh. 5 - Prob. 10RQ
Ch. 5 - Prob. 11RQCh. 5 - Prob. 12RQCh. 5 - Prob. 13RQCh. 5 - Prob. 14RQCh. 5 - Prob. 16RQCh. 5 - Prob. 17RQCh. 5 - Prob. 18RQCh. 5 - Prob. 19RQCh. 5 - Prob. 20RQCh. 5 - Prob. 1PECh. 5 - Prob. 2PECh. 5 - Prob. 3PECh. 5 - Prob. 4PECh. 5 - Prob. 5PECh. 5 - Prob. 6PECh. 5 - Prob. 7PECh. 5 - Prob. 8PECh. 5 - Prob. 9PECh. 5 - Prob. 10PECh. 5 - Prob. 1GZCh. 5 - Prob. 2GZCh. 5 - Prob. 3GZCh. 5 - Prob. 4GZCh. 5 - Prob. 5GZ
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write an application that prompts for and reads the numeratorand denominator of a fraction as integers and then prints the decimal equivalent of the fraction.arrow_forwardIn Java. Prompt the user for two years. Print all the movies that were released in those years and that have a name that's fewer than 6 characters. File: db.txt Test Case 1 Movie search by year range. Enter two years.\n1970ENTER1974ENTERMovies with short names that were released between 1970 and 1974\nI dag\nIzumi\nJamie\nJamie\nJulie\nJulie\nKako\nKako\nKate\nKojak\nKojak\nKojak\nKojak\nKojak\nLeeds\nMaude\nMeshi\nMily\nNakia\nNakia\nNakia\nNakia\nNancy\nNanou\nTang\nThem\nTimo\nToma\nToma\nToma\nToma\nTotte\nTrial\nUFO\nUFO\nYak\nYak\nZoom\nZut!\nNumber of matches: 39\n Test Case 2 Movie search by year range. Enter two years.\n2050ENTER3000ENTERMovies with short names that were released between 2050 and 3000\nNo matching movies found!\narrow_forwardCreate a java program that reads integers from the user until the enter key is pressed. Oncea allof the integers have been read your program should display all of the negativen numbers followed by all of the zeros, followed by all of the positive numbers. Withine eachgroup the numbers should be displayed in the same order that they were enteredbyt theuser. For example, if the user enters the values 3, -4, 1, 0, -1, 0, and -2 thenyourp programshould output the values -4, -1, -2, 0, 0, 3, and 1. Your programshould displaye eachvalue on its own line.arrow_forward
- Write a program that prompts the user to enter twocharacters and displays the major and status represented in the characters. The firstcharacter indicates the major and the second is number character 1, 2, 3, 4, whichindicates whether a student is a freshman, sophomore, junior, or senior. Supposethe following characters are used to denote the majors:I: Information ManagementC: Computer ScienceA: Accounting Here is a sample run: Enter two characters: I1 ↵EnterInformation Management Freshmanarrow_forwardWrite a program that begins by reading a temperature from the user in degrees Celsius. Then your program should display the equivalent temperature in degrees Fahrenheit and degrees Kelvin. The calculations needed to convert between different units of temperature can be found on the internet.arrow_forwardWhat is the output of the following code segment?intc=6,6=12;if(cd);Write(Green);WriteLine(Yellow); Green Yellow GreenYellow nothingarrow_forward
- In Chapter 4, you created a program that generates a random number, allows a user to guess it, and displays a message indicating whether the guess is too low, too high, or correct. Now, create a modified program called GuessingGame2 in which the user can continue to enter values until the correct guess is made. After the user guesses correctly, display the number of guesses made. Recall that you can generate a random number whose value is at least min and less than max using the following statements: Random ranNumber = new Random(); int randomNumber; randomNumber = ranNumber.Next(min, max);arrow_forwardWrite an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If the score entered is less than 0 or more than 10, display Score must be between 10 and 0 and do not use the score. After all the scores have been entered, display the number of valid scores entered, the highest score, the lowest score, and the arithmetic average.arrow_forwardI need to create a restaurant menu , allow the user to choose only 3 meals and output the sum of the meals that the user chose. using java programming the menu is : Beef burger $4.25 Cola $1.50 Donats $1.50 Plane Bagle $2.65 Cheese Bagle $5.00arrow_forward
- Create an application in Java that converts number grades to letter grades. ConsoleWelcome to the Letter Grade ConverterEnter numerical grade: 90Letter grade: AContinue? (y/n): yEnter numerical grade: 88Letter grade: AContinue? (y/n): yEnter numerical grade: 80Letter grade: BContinue? (y/n): yEnter numerical grade: 67Letter grade: CContinue? (y/n): yEnter numerical grade: 59Letter grade: FContinue? (y/n): nSpecificationsThe grading criteria is as follows: A 88-100B 80-87C 67-79D 60-67F <60 Assume that the user will enter valid integers between 1 and 100 for the grades. The application should only continue if the user enters 'y' or 'Y' in response.arrow_forwardWrite a program that prompts the user for a U.S. dollar amount and then converts it to Japanese Yen, British Pound, and New Zealand currency. Once you calculate the conversion, print a single line with each converted currency only showing two decimal places, and its respective code (as shown in the example below): 10 U.S. Dollars in Egyptian Pound (exchange rate = 15.9976) would print as follows after conversion: 10.00 USD in Egyptian Pound is 159.98 EGParrow_forwardCreate a Java application which will take an infix algebraic expression as an input from user. It will check that whether it is a valid expression or not. Then It will be converted into postfix expression, and at the end it will be evaluated and print the result of the expression. For example:if input is: (3+5)*(7output: it is invalid.If input is: (3+5)*7 , displayPostfix form: 35+7*Answer: 56.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Files & File Systems: Crash Course Computer Science #20; Author: CrashCourse;https://www.youtube.com/watch?v=KN8YgJnShPM;License: Standard YouTube License, CC-BY
UNIX Programming (Part - 10) The File System (Directories and Files Names); Author: ITUTEES;https://www.youtube.com/watch?v=K35faWBhzrw;License: Standard Youtube License