fork-commit-merge / fork-commit-merge

Fork, Commit, Merge. A project designed to help you familiarize yourself with the open source contribution workflow on GitHub!

Home Page:https://forkcommitmerge.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fork, Commit, Merge - Medium Issue (Java)

nikohoffren opened this issue · comments

Fork, Commit, Merge - Medium Issue (Java)

Create a Calculator in Java

Note: You don't have ask permission to start solving the issue or get assigned, since these issues are supposed to be always open for new contributors. The actions-user bot will reset the file back to previous state for the next contributor after your commit is merged. So you can just simply start working with the issue right away!

Navigate to the tasks/java/medium directory from the root of your project.
Then open a file called Calculator.java and start implementing the Calculator class!

Description:

Create a simple calculator class in Java that performs basic operations: addition, subtraction, multiplication, and division.

Requirements:

  • The calculator class should have methods called add, subtract, multiply and divide.
  • The calculator should be able to handle both integers and floating-point numbers.

Don't modify the code in the main method! It contains bunch of tests that will run when the program is executed.

How to run:

Make sure you are in the right directory:

cd tasks/java/medium

Compile the program:

javac Calculator.java

Run the compiled program:

java Calculator.java

Expected output:

Addition: 8.0
Subtraction: 2.0
Multiplication: 15.0
Division: 1.6666666666666667

If the program works as requested in the task, you are ready to make a pull request!


To work with this issue, you need to have Java installed to your local machine.
Check out README.md for more instructions of installing Java and how to make a pull request.

Feel free to ask any questions here if you have some problems!

Also, kindly give this project a star to enhance its visibility for new developers!