Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i am having difficulty with this homework question (Convert decimals to fractions) Write a program that prompts the user to enter a decimal number and

i am having difficulty with this homework 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 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

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_2

Step: 3

blur-text-image_3

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

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

Finding and scheduling appointments with new prospective clients.

Answered: 1 week ago