Question: A pure infinitely - repeating decimal number is defined as a decimal where all digits in the fractional part are non - zero and repeat

A pure infinitely-repeating decimal number is defined as a decimal where all digits in the fractional part are non-zero and
repeat infinitely. For example, 3.142857 represents a pure infinitely-repeating decimal number with the repeating sequence
142857. Conversely, 3.6142857 is not a pure infinitely-repeating decimal number as it contains non-repeating digits in its
fractional part. In this problem, it is assumed that all decimal numbers provided are pure infinitely-repeating. Please write a
program to compute the sum of two pure infinitely-repeating decimal numbers.
Input Format (Please use java.util.Scanner to read the input.)
The first line is an integer n indicating the number of test cases. Each test case consists of two pure infinitely-repeating
decimal numbers x and y. Both x and y may be positive. For example, 9.2 indicates 9.2; 3.56 indicates 3.56.
Output Format
For each test case consisting of pure infinitely-repeating decimal numbers x and y, print the sum of x and y.
Note that your output may either a pure infinitely-repeating decimal number or an integer. Even though 0.14285714 and
0.142857 are numerically equal, the former is not allowed. For 0.9, your program should output an integer, rather than a
decimal.
Each test case consists of two decimal numbers x and y from (0,100)Sample Input and Output
(1)9.2+3.56
9.22+3.56=12.78
(2)2.34+1.234
2.343434+1.234234=3.577668
-
(3)6.80.142857
6.888888+0.142857=7.031756()
Sample Input and Output
0.bar(9).
(4)1.234+4.321=5.5(5.555)
(5)88.3+11.6=100(99.9)
API:
double java.lang.Double.parseDouble(String s)
String java.lang.Double.toString(double d)
String java.lang.String.substring(int beginIndex)
double java.lang.Math.pow(double a, double b)
long java.lang.Math.round(double a)
String java.lang.String.format(String format, Object... args)
 A pure infinitely-repeating decimal number is defined as a decimal where

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!