EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
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
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.
Java. Write an 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 Im Adam” are palindromes. Display the appropriate feedback: You entered a palindrome or You did not enter a palindrome. An example of the program is shown below: Enter a stringWas it a car or a cat I sawYou entered a palindrome
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     } }
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