Skip to content

๐Ÿงฎ A fully-featured Java Scientific Calculator based on Reverse Polish Notation (RPN) and advanced stack operations, developed with a GUI, JUnit testing, and UML planning. Built as part of a university software engineering project using the Waterfall model.

License

Notifications You must be signed in to change notification settings

francescopiocirillo/java-rpn-scientific-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

77 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿงฎ Java RPN Scientific Calculator with Stack Operations

๐Ÿš€ A fully functional scientific calculator using Stack-Based Reverse Polish Notation, built in Java, designed with Waterfall methodology, and developed in a collaborative software engineering environment as part of a university project.


๐Ÿ“Œ Overview

StackBasedCalculator is a fully-featured Reverse Polish Notation (RPN) scientific calculator developed as part of a team project for a university Software Engineering course. Built with Java and the Waterfall development model, this project demonstrates modular architecture, collaborative coding, and extensive testing.

๐Ÿ“ Project Highlights

  • โœ… RPN (postfix) input processing

  • ๐Ÿง  Stack-based operations and memory

  • ๐ŸŽจ GUI interface with calculator-like appearance

  • ๐Ÿงช JUnit test suite for core components

  • ๐Ÿ“Š UML & Gantt-based planning

  • ๐Ÿ“Œ Developed in a simulated real-world environment


๐ŸŒ Language Note

All code comments and internal documentation are written in Italian, as the project was developed during a group exam at the University of Salerno (Italy).

Despite this, the codebase follows international best practices, with clear method names and class structures that make it easily understandable for global developers and recruiters.


๐Ÿ’ก Features

๐Ÿ”ข Stack Operations

  • clear โ€“ remove all elements

  • drop โ€“ remove top element

  • dup โ€“ duplicate top element

  • swap โ€“ swap top two elements

  • over โ€“ duplicate second-to-top element

โž• Arithmetic & Variables

  • Basic operations: +, -, *, /

  • 26 memory variables: a through z

    • >x โ€“ Load top of stack into variable x

    • <x โ€“ Push value from variable x onto the stack

    • +x, -x โ€“ Perform arithmetic with variable x and top of stack

๐Ÿงฎ Advanced Capabilities

  • Complex number support

  • Rich exception handling (stack underflow, invalid operations, etc.)

  • GUI with custom calculator fonts


๐Ÿง  Development Process

Developed over 2 months, this project followed a strict Waterfall model, simulating a professional software lifecycle.

  1. โœ… Requirements Analysis

  2. ๐Ÿ“… Gantt Chart Planning

  3. ๐Ÿ“ Design using UML

  4. ๐Ÿ’ป Development in Java

  5. ๐Ÿงช JUnit Testing

  6. ๐Ÿš€ Final Release and Live Demo

All milestones and deadlines were met โ€” reflecting a real-world agile workflow within an academic structure.


๐Ÿงช Testing

Comprehensive unit testing was performed using JUnit, ensuring correctness of:

  • Stack operations

  • Variable manipulation

  • Complex number calculations

Test classes are located in:

test/java/AH/gruppo14/stackbasedcalculator/

๐Ÿ“‹ Documentation

You can find documentation and technical reports inside the docs/ folder, including:

  • Requirements Elicitation and Analysis Report: Contains the process of gathering and analyzing the project requirements, outlining the needs and expectations of stakeholders.

  • Use Case Diagrams: Describe specific scenarios in which the system will be used, detailing how users interact with the system to achieve a goal.

  • Activity Diagrams: Represent workflows and processes within the system, showing the sequence of activities and decision points.

  • Class Diagram: Illustrates the systemโ€™s structure, highlighting classes, attributes, methods, and the relationships between different entities in the system.

  • User Manual: Provides instructions and guidance for end-users on how to operate and interact with the system effectively.


๐Ÿงฑ Project Structure

๐Ÿ“ฆ StackBasedCalculator
โ”œโ”€โ”€ ๐Ÿ“ docs
โ”‚   โ”œโ”€โ”€ 1 - Requirements Elicitation and Analysis.pdf
โ”‚   โ”œโ”€โ”€ 2 - Use Case.pdf
โ”‚   โ”œโ”€โ”€ 3 - Activity Diagram.pdf
โ”‚   โ”œโ”€โ”€ 4 - Class Diagram.pdf
โ”‚   โ””โ”€โ”€ 5 - User Manual.pdf
โ”œโ”€โ”€ ๐Ÿ“ resources/fonts
โ”‚   โ”œโ”€โ”€ Calculator.ttf
โ”‚   โ””โ”€โ”€ LEDCalculator.ttf
โ”œโ”€โ”€ ๐Ÿ“ src/main/java
โ”‚   โ””โ”€โ”€ AH/gruppo14/stackbasedcalculator/
โ”‚       โ”œโ”€โ”€ BaseView.java, Buttons.java, CalculatorView.java
โ”‚       โ”œโ”€โ”€ StackCalculator.java, StackBasedCalculator.java
โ”‚       โ”œโ”€โ”€ StackCalculatorController.java
โ”‚       โ”œโ”€โ”€ CalculatorStack.java, CalculatorVariables.java, Complex.java
โ”‚       โ”œโ”€โ”€ StackView.java, VariablesView.java, SystemInfo.java
โ”‚       โ””โ”€โ”€ ๐Ÿ“ Eccezioni (Custom Exceptions)
โ”‚           โ””โ”€โ”€ StackVuotoException.java, StackPienoException.java, etc.
โ”œโ”€โ”€ ๐Ÿ“ test/java/AH/gruppo14/stackbasedcalculator/
โ”‚   โ””โ”€โ”€ CalculatorStackTest.java, ComplexTest.java, etc.
โ””โ”€โ”€ pom.xml, .gitignore, README.md

๐Ÿ“ธ User Interface Snapshot

image


๐Ÿ‘ฅ Team 14 โ€“ University of Salerno


๐Ÿš€ How to Run Locally

  1. Clone the repo

    git clone https://github.com/francescopiocirillo/java-rpn-scientific-calculator.git
  2. Open in your preferred IDE (NetBeans, VS Code, IntelliJ)

  3. Run DummyMain.java to launch the application

๐Ÿงฉ Development Environment

  • โ˜• Java version: 23.0.1
  • ๐ŸŽญ JavaFX SDK version: 24.0.1

๐Ÿ“ฌ Contacts

โœ‰๏ธ For questions or suggestions, feel free to contribute or report any corrections! Open an Issue!๐Ÿš€


๐Ÿ“ˆ SEO Tags

Java RPN Calculator, Reverse Polish Notation Calculator, Stack-based Calculator Java, Java Scientific Calculator, RPN Scientific Calculator, Stack operations calculator, Waterfall methodology software, Collaborative Java project, JUnit testing in Java, UML design in Java, Stack-based calculator features, Java complex number calculator, GUI scientific calculator Java, RPN calculator with variables, Java programming university project, University of Salerno Java project, Stack-based architecture, Calculator with memory variables, Exception handling in Java, Postfix calculator Java, Calculator development team project, Software engineering Java project, Open-source scientific calculator, Java programming for beginners, Java unit testing, StackVuotoException Java, Java StackOverflowException handling, Reverse Polish Notation stack operations, RPN calculator GUI interface, Java Waterfall methodology project, Collaborative coding Java, Java StackCalculator project, University project with UML and Gantt


๐Ÿ“„ License

This project is licensed under the MIT License, a permissive open-source license that allows anyone to use, modify, and distribute the software freely โ€” as long as credit is given and the original license is included.

In plain terms: use it, build on it, just donโ€™t blame us if something breaks.

โญ Like what you see? Consider giving the project a star!


About

๐Ÿงฎ A fully-featured Java Scientific Calculator based on Reverse Polish Notation (RPN) and advanced stack operations, developed with a GUI, JUnit testing, and UML planning. Built as part of a university software engineering project using the Waterfall model.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages