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 application to pre-sell a limited number of cinema tickets. Each buyer can buy as many as 4 tickets. No more than 100 tickets can be sold. Implement a program called Ticket Seller that prompts the user for the desired number of tickets and then displays the number of remaining tickets. Repeat until all tickets have been sold, and then display the total number of buyers.
Create 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.
Create an application in Java that uses card layout with three cards. The first card - a login card - should have two text fields, one for username and other for password. There are two users - Bob and Fred - whose passwords are "mubby and "goolag" respectively. If Bob logs in, switch to a card - the bob card - that has a text field, a text area and two buttons. If the first button is pressed, get the text from the text field and append it to the text area. If the second button is pressed, return to the login card. If Fred logs in, switch to a card - the fred card - that has three buttons. If the first button is pressed, change the background color to green. If the second  button is pressed, change the background color to red. If the third button is pressed, return to login card.
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