Question: fix code: import java.math.BigInteger; import java.util.Scanner; public class Exercise13_19 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print(Enter a decimal number:

fix code:

import java.math.BigInteger; import java.util.Scanner;

public class Exercise13_19 { public static void main(String[] args) { Scanner input = new Scanner(System.in);

System.out.print("Enter a decimal number: "); String[] decimal = input.nextLine().split("[.]");

Rational r1 = new Rational(new BigInteger(decimal[0]), BigInteger.ONE); Rational r2 = new Rational(new BigInteger(decimal[1]), new BigInteger( String.valueOf((int)Math.pow(10, decimal[1].length()))));

System.out.println("The fraction number is " + (decimal[0].charAt(0) == '-' ? (r1).subtract(r2) : (r1).add(r2))); } }

Exercise13_19.java:121: error: class, interface, or enum expected

import java.math.BigInteger;

^

Exercise13_19.java:122: error: class, interface, or enum expected

import java.util.Scanner;

^

2 errors

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!