Question: I am having difficulty with this homework question, It has to be written in java using this (https://liveexample.pearsoncmg.com/test/Exercise13_19.txt) as the starting point. (Convert decimals to

I am having difficulty with this homework question, It has to be written in java using this (https://liveexample.pearsoncmg.com/test/Exercise13_19.txt) as the starting point.

(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 Rational class in LiveExample 13.13 to obtain a rational number for the decimal number. Use the template at https://liveexample.pearsoncmg.com/test/Exercise13_19.txt for your code.

Sample Run 1

Enter a decimal number: 3.25

The fraction number is 13/4

Sample Run 2

Enter a decimal number: -0.45452

The fraction number is -11363/25000

Class Name: Exercise13_19

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!