Question: (Convert decimals to fractions) Write a program that prompts the user to enter a decimal number and displays the number in a fraction. Hint: read
(Convert decimals to fractions) Write a program that prompts the user to enter a decimal number and displays the number in a fraction. Hint: read the decimal number as a string, extract the integer part and fractional part from the string, and use the BigInteger implementation of the Rational class in Programming Exercise 13.15 to obtain a rational number for the decimal number.
Here are some sample runs: Enter a decimal number: 3.25 The fraction number is 13/4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
