Question: Create a menu-driven DigitExtractor application that prompts the user for an integer and then displays the ones, tens, or hundreds digit of the number. This

Create a menu-driven DigitExtractor application that prompts the user for an integer and then displays the ones, tens, or hundreds digit of the number. This program must have two classes: DigitExtractor and Num. The DigitExtractor class should contain the main() method. The main() method should prompt the user for an integer and this number should be passed to the constructor in the Num class. The Num class should contain the constructor, the wholeNum() method which should return the whole number to the main() method, the onesPlace() method which should return the ones digit to the main() method, the tensPlace() method which should return the tens digit to the main() method, and the hundredsPlace() method which should return the hundreds digit to the main() method.. This means that the DigitExtractor class should include a Num object to call the methods in the Num class.

Sample I/O:

Enter an integer: 56789

(W) hole number.

(O) nes place number.

(T) ens place number.

(H) undreds place number.

(Q) uit

Enter you choice: H

The hundreds place digit is:7

(W) hole number.

(O) nes place number.

(T) ens place number.

(H) undreds place number.

(Q) uit

Enter you choice: W

The whole number is: 56789

(W) hole number.

(O) nes place number.

(T) ens place number.

(H) undreds place number.

(Q) uit

Enter you choice: Q

Enter, edit, compile, debug (if necessary) and execute your Java program using JCreator.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!