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
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
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