Skip to content

ChristianHosh/Scientific-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scientific Calculator

This document provides an overview of the data structure course project, a scientific calculator, developed by Christian Hosh in the second year of studying computer science at Birzeit University. The project was implemented in Java programming language, and it employs a cursor stack data structure that was created manually. The user interface was developed using JavaFX.

Objective

The objective of the project was to create a scientific calculator that can perform basic arithmetic operations such as addition, subtraction, multiplication, and division, as well as advanced mathematical functions such as square root, exponential, trigonometric functions, logarithms, and others. The calculator should support parentheses and obey the order of operations.

Data Structure

The data structure used in the calculator is a cursor stack. A cursor stack is a data structure that is a variation of a stack. In a cursor stack, each element has a cursor that points to the previous element. The cursor allows for fast traversal of the stack and easy deletion of elements.

Screenshot 2023-05-02 002938 Screenshot 2023-05-02 002957

User Interface

The user interface of the calculator was developed using JavaFX. The main window of the calculator contains three textboxes:

Input Textbox: This textbox displays the expression entered by the user. Postfix Textbox: This textbox displays the postfix notation of the entered expression. Result Textbox: This textbox displays the final result of the operation.

The user can input expressions using a keypad and the buttons for basic arithmetic operations and advanced functions. The calculator supports keyboard input as well. As the user enters an expression, the input textbox updates in real-time. Once the expression is entered, the calculator converts it to postfix notation and displays it in the postfix textbox. The final result of the calculation is displayed in the result textbox. The user can clear the input, postfix, and result textboxes using the clear button.

Functionalities

The calculator supports the following functionalities:

Basic arithmetic operations: addition, subtraction, multiplication, and division. Advanced mathematical functions: square root, exponential, trigonometric functions, logarithms, and others. Parentheses: the calculator supports the use of parentheses and obeys the order of operations.

The calculator also supports error detection for input expressions. If the user enters an invalid expression, such as mismatched parentheses or an invalid mathematical function, the calculator displays an error message in the result textbox. This functionality helps the user to correct their input and avoid incorrect results as shown below.

Screenshot 2023-05-02 003017

About

Scientific Calculator Using Cursor Stacks In Java

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages