EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
8th Edition
ISBN: 9781305480537
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Videos

Question
Book Icon
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.

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.

Blurred answer
Students have asked these similar questions
Write an Java application that determines whether a phrase entered by the user is a palindrome. A palindrome is a phrase that reads the same backward and forward without regarding capitalization or punctuation. For example, “Dot saw I was Tod”, “Was it a car or a cat I saw?”, and “Madam, I’m Adam” are palindromes. Display the appropriate feedback: You entered a palindrome or You did not enter a palindrome.   import java.util.*; public class Palindrome {     public static void main(String[] args) {         // Write your code here     } }
Help with JavaFX barchart:   I have a program that allows a user to deposit and withdraw money while updating their balance based on the month the transaction occured, but I am having trouble with the programs class and am trying to make a bar chart that will have the total balance of that month, so as an example in May the bar would show $70, while the bar for June would show $100, even if the deposits were $20 and $50, then $30, $40 and $30.
a. Write an application that prompts a user for a month, day, and year. Display a message that specifies whether the entered date is (1) not this year, (2) in an earlier month this year, (3) in a later month this year, or (4) this month. Save the file as PastPresentFuture.java.   b. Use the web to learn how to use the LocalDate Boolean methods isBefore(), isAfter(), and equals(). Use your knowledge to write a program that prompts a user for a month, day, and year, and then displays a message specifying whether the entered day is in the past, the current date,or in the future. Save the file as PastPresentFuture2.java.
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
    Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
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