Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

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 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions