Problem

Write a program that converts dates from numerical month–day format to alphabetic month–...

Write a program that converts dates from numerical month–day format to alphabetic month–day format. For example, input of 1/31 or 01/31 would produce January 31 as output. The dialogue with the user should be similar to that shown in programming project.You should define two exception classes, one called MonthException and another called DayException. If the user enters anything other than a legal month number (integers from 1 to 12), your program should throw and catch a MonthException. Similarly, if the user enters anything other than a valid day number (integers from 1 to either 29, 30, or 31, depending on the month), your program should throw and catch a DayException. To keep things simple, assume that February always has 28 days.

Write a program that uses the class Calculator in listing to create a more powerful calculator. This calculator will allow you to save one result in memory and call the result back. The commands the calculator takes are

e for end

c for clear; sets result to zero

m for save in memory; sets memory equal to result

r for recall memory; displays the value of memory but does not change result

You should define a derived class of the class Calculator that has one more instance variable for the memory, a new main method that runs the improved calculator, a redefinition of the method handleUnknownOpException, and anything else new or redefined that you need. A sample interaction with the user is shown next. Your program need not produce identical output, but it should be similar and just as clear or even clearer.

Calculator on:result = 0.0+ 4result + 4.0 = 4.0updated result = 4.0⁄ 2result ⁄ 2.0 = 2.0updated result = 2.0mresult saved in memorycresult = 0.0+ 99result + 99.0 = 99.0updated result = 99.0⁄ 3result ⁄ 3.0 = 33.0updated result = 33.0rrecalled memory value = 2.0result = 33.0+ 2result + 2.0 = 35.0updated result = 35.0eEnd of program

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 9
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT