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
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