Explore BrainMass

Explore BrainMass

    Write a big-inteter calculator program

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write a big-inteter calculator program that allows the user to enter two large integers and the operation to be performed and that calls the appropriate function to carry out the designated operation.

    © BrainMass Inc. brainmass.com December 24, 2021, 5:09 pm ad1c9bdddf

    Solution Preview

    As a demonstration of how to customize the framework, we present a simple calculator. Here are
    the basic commands:
    C:PearceJPOPconsole>java Calculator

    type "help" for commands
    -> help
    Console Help Menu:
    about: displays application information
    help: displays this message
    quit: terminate application
    ARG1 + ARG2 = sum of ARG1 and ARG2
    ARG1 * ARG2 = product of ARG1 and ARG2
    ARG1 - ARG2 = difference of ARG1 and ARG2
    ARG1 / ARG2 = quotient of ARG1 and ARG2
    Note 1: Spaces between tokens are required
    Note 2: ARG1 & ARG2 are numbers.
    The about command displays information about the framework and the customization:
    -> about
    Console Framework
    copyright (c) 2001, all rights reserved

    A Simple Calculator
    Copyright (c) 2001, all rights reserved
    Of course we can do arithmetic and small errors don't break the calculator:
    -> -13 + 51
    result = 38.0
    -> 12 / 0
    Application error, can't divide by 0
    -> 13.8 * 3.1416
    result = 43.35408
    -> x + 2
    Application error, ARG1 & ARG2 must be numbers
    -> quit
    The Console Framework
    The console framework provides two classes: Console and AppError. All application-specific errors discovered in the customization are handled by throwing an AppError. The Console class supplies a control loop, and overridable help(), about() , handle(), and execute() methods. In fact, execute() is abstract, ...

    Solution Summary

    Write a big-inteter calculator program