Question
Write a program that prompts the user for one of the numbers 1, 2, 3, ..., 12 and outputs the corresponding month name January, February,
Write a program that prompts the user for one of the numbers 1, 2, 3, ..., 12 and outputs the corresponding month name January, February, March, ... , December.
Implementation: Write a class Month with a constructor Month(int number) that takes the month number and creates a Month type object. Make a very long string "January February March ... ", in which you add spaces such that each month name has the same length. Then use substring to extract the month you want. An instance method String monthString() should return the correct substring. Must use s.trim , I chose to use incriments of 10 so it would be easy to recall. Also I need a class and tester class.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started