Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Find future dates) Write a program that prompts the user to enter an integer for today's day of the week (Sunday is 0, Monday is

image text in transcribed

(Find future dates) Write a program that prompts the user to enter an integer for today's day of the week (Sunday is 0, Monday is 1, ... and Saturday is 6). Also prompt the user to enter the number of days after today for a future day and display the future day of the week. Here is a simple run: O for Sunday 1 for Monday 2 for Tuesday 3 for Wednesday 4 for Thursday 5 for Friday 6 for Saturday Enter today's day: 1 (enter) Enter the number of days elapsed since today: 3 (enter) Today is Monday and the future day is Thursday The assignment guideline: import the Scanner class from java.util package create the class called FutureDates create main method inside the main method block declare String datatype aDay and assign as empty string create Scanner object prompt for the user to choose today's day take the user input with nextInt() method and assign the value to today variable with int datatype use if-else statement to determine the value for a Day prompt for the user to type the number of days started from today's day take the user input with nextInt() method and assign the value to futureDay variable with int datatype calculate the future day and using the switch statement with case 0 to case 6 and default and then print out the today's day and future day

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions