Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java Please, need help: In the subtractBigInteger() method, you are provided with a char stack, stackResult. You will need to perform subtractions between the

In Java Please, need help: In the subtractBigInteger() method, you are provided with a char stack, stackResult. You will need to perform subtractions between the two operands and save the result on the result stack. Pay attention to the order of the digits (see above figure for reference). You should compute the subtraction between the two big numbers digit by digit (from low to high). Be sure to take care of borrows. Do not create any arrays or import the java.math.BigInteger library or anything from the Character, Integer, Double, and String classes in your implementation! Same as above, you are only supposed to deal with the digits at the char and int level and make use of stacks. Note that you are only supposed to touch the above two methods. You are NOT allowed to create any other methods, instance variables, or make any changes to methods other than the two method or files other than "StackApps.java". Points will be taken off if you fail to follow this rule.

public class StackApps { // convert a decimal number into a binary number and save it in a stack // Do not create any arrays! Do not use any Java libraries to do the convertion. // Doing so will result in points deduction. public String decToBin(int numDec) { CharStack stackBinary = new CharStack(64); // stack used to store the result binary number // TODO: complete this method return stackBinary.toString(); // return a string representation of the stack } // subtract num2 from num1 (both represented as CharStacks), and save the result on a stack // Do not create any arrays! Do not use any Java libraries to do the calculation. // Doing so will result in points deduction. public String subtractBigInteger(CharStack num1, CharStack num2) { CharStack stackResult = new CharStack(64); // stack used to store the result of the addition // TODO: complete this method return stackResult.toString(); // return a string representation of the stack } }

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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago