Write a program that takes a string as input from keyboard


Problem

Write a program that takes a String as input from the keyboard, representing a year. Your program should do the following:

• If the year entered has two characters, convert it to an int, add 2000 to it, and output it.
• If the year entered has four characters, just convert it to an int and output it.
• If the year entered has neither two nor four characters, output that the year is not valid.

Output requirements

When evaluating the year, you must use an if-else block
Please enter a 2-digit or 4-digit year: (user supplied value)
The year entered is (result).

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Write a program that takes a string as input from keyboard
Reference No:- TGS03242039

Expected delivery within 24 Hours