Skip to content

Maedot13/CommandLineArgument

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Command-Line Calculator

A simple Java calculator that runs in the terminal.

How to Use

1. Compile the program

javac CommandLineDemo.java

2. Run the calculator

java CommandLineDemo <number1> <operator> <number2>

Examples

java CommandLineDemo 10 + 5
java CommandLineDemo 15 - 3
java CommandLineDemo 7 * 6
java CommandLineDemo 20 / 4

Available Operations

+ : Addition

- : Subtraction

* : Multiplication

/ : Division

Example Output

$ java CommandLineDemo 10 + 5 Result: 15.0

$ java CommandLineDemo 20 / 0 Error: Division by zero!

Requirements

Java (JDK 8 or higher)

Quick Start

Save the Java code as CommandLineDemo.java

Open a terminal in the same folder

Compile the program:

javac CommandLineDemo.java

Run the calculator:

java CommandLineDemo 5 + 3

Use "*" or \* to multiply 

java CommandLineDemo 5 "*" 3

java CommandLineDemo 5 \* 3

About

This reposetery is for commandLine Argument which allow you to pass information to your Java program when you run it from the terminal/command prompt.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors