JAVA PROGRAMMING-LMS INTEG.MINDTAP
JAVA PROGRAMMING-LMS INTEG.MINDTAP
8th Edition
ISBN: 9781337091503
Author: FARRELL
Publisher: Cengage Learning
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
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.
in Java Write a program that establishes two savings accounts with saver1 having account number10002 with an initial balance of $2,000, and saver2 having account 10003 with an initialbalance of $3,000. Set a common rate of interest at 5% per year. At the end of each month,update the balance by adding one month’s interest to the balance, so that the balancecompounds monthly. Print an output that displays the month number and the account numberand the balance for each of the two accounts. Use month 0 to display the initial balances, month1 to display the balances after the first month’s interest, and so on. At the end of the year,display the total balance for both accounts combined, like this:Output:Monthly balances for one year with 0.05 annual interest:Month Account # Balance Account # Balance----- --------- ------- --------- ------- 0 10002 2000.00 10003 3000.00 1 10002 2008.33 10003 3012.50 2 10002 2016.70 10003 3025.05 3 10002 2025.10 10003 3037.66 4 10002 2033.54 10003 3050.31 5…
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.
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