Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODING IN JAVA Dates are printed in several common formats. Two of the more common formats are: 07/21/55 and July 21, 1955 Write a program

CODING IN JAVA

Dates are printed in several common formats. Two of the more common formats are:

07/21/55 and July 21, 1955 Write a program that reads a date in the first format and prints that date in the second format. Prompt the user and accept user input for the date in MM/DD/YYYY format. Retrieve the month portion of the date entered and convert it to an integer. Do the same thing for day and year Create a string named months that contains the number of the month and the name of the month: 1 January2 February3 March. Convert the month into a string Find the index where the numeric value for the month is held Retrieve the text version of the month. Output the date in expanded format. //Sample run #1 Enter a date in MM/DD/YYYY format: 04/12/2000 April 12, 2000

//Sample run #2 Enter a date in MM/DD/YYYY format: 11/10/2000 November 10, 2000

//Sample run #3 Enter a date in MM/DD/YYYY format: 12/20/2000 December 20, 2000

Note that for sample run 3, you are likely to get an out of bounds error unless you provide a 13th option within the string. Exception in thread "main" java.lang.StringIndexOutOfBoundsException: begin 90, end -1, length 98 at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3107) at java.base/java.lang.String.substring(String.java:1873) at edu.ilstu.DateProgram.main(DateProgram.java:20)

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

Database Systems For Advanced Applications 9th International Conference Dasfaa 2004 Jeju Island Korea March 2004 Proceedings Lncs 2973

Authors: YoonJoon Lee ,Jianzhong Li ,Kyu-Young Whang

2004th Edition

3540210474, 978-3540210474

More Books

Students also viewed these Databases questions

Question

What do we know about thinking in other species?

Answered: 1 week ago

Question

Group Size and Communication

Answered: 1 week ago

Question

Understanding Group Roles

Answered: 1 week ago