Giter Club home page Giter Club logo

ph-7 / simple-java-calculator Goto Github PK

View Code? Open in Web Editor NEW
213.0 36.0 445.0 234 KB

:1234: Simple calculator is written in Java with Eclipse. This calculator is simple with an easy code to help novices learn how to operate a calculator.

Home Page: https://ph-7.github.io/Simple-Java-Calculator/

License: Apache License 2.0

Java 100.00%
calculator java java-calculator learn teaching learning-java simple-java-calculator java-learning java-study java-simple-project java-swing

simple-java-calculator's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simple-java-calculator's Issues

Extend SimpleJavaCalculator

Hello,
I appreciate your work,i really like your project.
I try to extend your code,so i add three new buttons.
Specifically i add x^y button,which calculates x(first number) power of y(second number).Second button is log10(x),which calculates the logarithm of a number x.Finally i add x% button,which calculates the percentage of the number x.
I also upload the files with changes,so you can check it.
I hope you find it helpful.

Friendly,
Donis Chantzaridis

simplejavacalculator.zip
2f4e7b4079cfb65c4c1d7128b06801ae

New logo/icon proposal

Good day sir. I am a graphic designer and i am interested in designing a logo for your good project. I will be doing it as a gift for free. I just need your permission first before I begin my design. Hoping for your positive feedback. Thanks

Add modulo function

Suggestion for new feature

I noticed that the calculator does not offer the modulo operation (which returns the remainder during a division of two numbers).
So, I could add this specific feature.

Remove private nbproject folder from repository

There is a folder called private under the nbproject folder. This folder contains private information that is machine specific and not project specific.
According to the following link:
http://docs.oracle.com/cd/E50453_01/doc.80/e50452/create_japps.htm#NBDAG2974

If the project is checked out of a version control system, the build (or nbbuild), dist (or nbdist), and the nbproject/private folders should not be checked into that version control system. If the project is under the CVS, Subversion, or Mercurial version control systems, the appropriate "ignore" files are created or updated for these directories when the project is imported. Though nbproject/private should be ignored, nbproject should be checked into the version control system. nbproject contains project metadata that enables other users to open the project in NetBeans without having to import the project first.

Refactor Code to SOLID

Project: SimpleJavaCalculator
File Affected: Calculator.java

Description
With the intention of implementing SOLID principles in the code, there is a violation of the SRP within the class, to solve the following change was proposed where the mathematical operations will be performed in another class.

SRP

Also, to avoid OCP, classes were created with the mathematical operations to be performed, if you want to implement new functions, only the class with the new operation is created. The classes already defined are not modified.

OCP

To avoid problems with LSP, 2 clear interfaces were defined that will be implemented by the operations according to the amount of information they need.

LSP

Finally, to respect the DIP principle, the class depends on abstractions and not on defined implementations, avoiding problems in the code flow.

DIP

Additional Notes:
I have a branch where the mentioned changes were made, packages and other necessary classes were added to keep the project in SOLID design principles.

Bug Report: Incorrect Use of .equals() Method for Object Comparison

Project: SimpleJavaCalculator
File Affected: Calculator.java
Line Number: [Line number where the bug is found, for example: 57]
Severity: High

Description:
The PMD tool detected an issue in Calculator.java related to the incorrect use of the .equals() method for object comparison. Using == or != for object comparison can lead to unintended behaviors since it checks for reference equality rather than content equality. In Java, when comparing objects for equality in terms of their content, the .equals() method should be employed.

Output from PMD:

[WARNING] PMD violation detected. Rule:UseEqualsToCompareStrings Priority:3 .equals() should be used to compare object references. 

Suggested Fix:
Replace the == or != comparison of objects with the .equals() method for accurate content-based comparison. Ensure that the class has a properly overridden .equals() method if needed.

Steps to Reproduce:

  1. Navigate to Calculator.java.
  2. Go to the mentioned line number.
  3. Observe the object comparison using == or !=.

Additional Notes:
This kind of bug can potentially lead to logical errors in the application. Even if the current implementation does not throw an error, it's a potential source of future bugs, especially if changes are made to the way objects are created or managed.

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.