Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A dual digit integer is a integer that is composed of only two digits and they are not interleaved. Examples of that would 45, 23,

A dual digit integer is a integer that is composed of only two digits and they are not interleaved. Examples of that would 45, 23, 555777, 882222, 10000, 2220, etc. But it cannot be 22222, 23223, 555245, 882228, etc. So, basically one single digit repeated 1 or more times, followed by another digit repeated one or more times. In this assignment, you are to write a program that reads a series of integers from standard input proceeded by an integer indicating how many numbers are there to read. Your program should compute the dual digit integer (as described above) that is a multiple of each of the integers in the input and is larger than each of them. The program should only display a description of the dual digit number but not the number itself. METHOD: ^^^^^^^ You are to ask the user for a list of numbers proceeded by a number telling you how many of them there are. For each integer, compute the smallest dual digit integer that is larger and is a multiple of each input integer, then print the description of each dual digit integer. The description of a dual digit integer should of the format s t p q, where s represents the number of digits t in the number, and p represents the number of the digits q. For example, if the dual digit integer is 7777222, then its description will be 4 7 3 2 (four sevens followed by 3 twos). If the number 4000, then its description Will be 1 4 3 0 (one 4 followed by 3 zeros). Also, 45 can be described by 1 4 1 5 Example program execution: Input: 5 <---- This is the number of integers to be considered. 9 13 125 150 2005 Notice the input has two numbers, and is terminated by a zero. Output: 9: 1 1 1 8 13: 1 2 1 6 150: 1 3 2 0 125: 1 5 2 0 2005: 3 2 3 5 Required Implementation: ^^^^^^^^^^^^^^^^^^^^^^^ You are required to implement a DualDigits.java class that contains a method to read in the numbers, let's call it inputNumbers, another method that computes dual digits, let's call it computeDualDigits for each of the numbers read into the input. The last method should be called describeDualDigits which should print out a description of the dual digit as illustrated above. The other class you're required to implement is a main class the uses the DualDigit.java class and only contains the main program. So the main should be simple and just contains : DualDigits d = new DualDigits(); // you can have your own constructor if you'd like d.inputNumbers(); d.computerDualDigits(); d.describeDualDigits();

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899