Giter VIP home page Giter VIP logo

stayreadylab02's Introduction

Stay Ready Lab 02

The Scientific Calculator

Description

  • Objective - To implement an ScientificCalculator which displays output of basic and scientific computations.

Requirements

Testing

  • All features must be tested.
  • Tests must include normal behavior, and any possible error situations.
  • Tests must have descriptive names and should be independent of each other (running or not running one test should not influence the behavior of any other test).

Documentation

  • You must produce UML diagrams for your program.

Core Features

  • All calculators should have the following features:

    • A state, representing the value currently displayed on the calculator (default 0)
    • Get the current number on the display
    • Clear the display
    • Add, subtract, multiply, and divide the value on the display by a given number
    • Calculate the square (x2) and square root (โˆšx) of the number on the display
    • Calculate variable exponentiation (xy)
    • Calculate the inverse of the number on the display (1/x)
    • Invert the sign of the number on the display (switch between positive and negative)
    • Update the display to Err if an error occurs (eg: Division by zero)
      • Errors must be cleared before any other operation can take place
  • Each operation should automatically update the display

Scientific Features

  • Switch display mode (binary, octal, decimal, hexadecimal)
    • switchDisplayMode() should rotate through the options
    • switchDisplayMode(String mode) should set the display to the mode given
  • Memory - Store up to one numeric value in memory for recall later (default to 0) *
    • (M+ key) Add the currently displayed value to the value in memory (store in memory and update display) *
    • (MC key) Reset memory *
    • (MRC key) Recall the current value from memory to the display *
  • Trig functions
    • Sine - Calculate the sine of the displayed value and display it
    • Cosine - Calculate the cosine of the displayed value and display it
    • Tangent - Calculate the tangent of the displayed value and display it
    • Inverse Sine
    • Inverse Cosine
    • Inverse Tangent
  • Switch trig units mode (Degrees, Radians)
    • switchUnitsMode() should rotate through the options
    • switchUnitsMode(String mode) should set the trig units to the type given

Bonus

  • Factorial function
  • Logarithmic functions
    • Log
    • 10x (inverse logarithm)
    • Ln (natural logarithm)
    • ex (inverse natural logarithm)

Custom Features

In addition to the Core and Scientific features, you are required to create at least two of your own features for the calculator. They can be any two features that are not already covered and that you can implement as you see fit. These features must be properly tested.

Hints

The following functions should take the displayed value (x) and updated it according to the given formula: (this may not be an exhaustive list)

  • square(): x2
  • squareRoot(): โˆšx
  • inverse(): 1/x
  • switchSign(): -x
  • sine(): sin(x)
  • cosine(): cos(x)
  • tangent(): tan(x)
  • inverseSine(): sin-1(x)
  • inverseCosine(): sin-1(x)
  • inverseTangent(): tan-1(x)
  • factorial(): x! (x factorial)

Submission

Completed projects should be submitted by submitting a pull request.

stayreadylab02's People

Contributors

code-rhino avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.