Question
ASAP please!! I am expecting something different answers from CHATGPT. Problem 2 (Adapted from Programming Exercises 13.18 - Use the FastRational class, 15 points): Download
ASAP please!! I am expecting something different answers from CHATGPT.
Problem 2 (Adapted from Programming Exercises 13.18 - Use the FastRational class, 15 points): Download FastRational.java from Canvas. It is the same as the Rational.java code from Chapter 13 except that it uses a faster way from Chapter 22 to compute GCDs. In a file called TestFastRationalSeries.java write a program that uses the FastRational class to compute the following summation:
1/2 + 2/3 + 3/4 + ... + 98/99 + 99/100
First display the result using its toString method, and then using its doubleValue method. You will discover that the output is incorrect:
Series sum = 1349247664274259951/1822963237492290880
Series sum = 0.7401398100217947 The actual sum should quite a bit larger. The culprit is integer overflow
FastRational.java
Page of 3 - ZOOM + // A rational number class that uses Euclid's Algorithm to quickly compute // greatest common divisors. public class FastRational extends Number implements ComparableStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started