Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scientificcalc #9

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,34 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-math</groupId>
<artifactId>commons-math</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>6.1.25</version>
</dependency>
<dependency>
<groupId>in.yajnesh.util</groupId>
<artifactId>java-util</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>user.java.lang</groupId>
<artifactId>user.java.lang</artifactId>
<version>2020.164.33984</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>clojars</id>
<name>Clojars</name>
<url>https://repo.clojars.org/</url>
</repository>
</repositories>


</project>
3 changes: 3 additions & 0 deletions src/main/java/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/main/java/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/main/java/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/main/java/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public static Integer getIntegerInput(String prompt) {
public static Double getDoubleInput(String prompt) {
return null;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,107 @@
package com.zipcodewilmington.scientificcalculator;

import java.util.Scanner;

/**
* Created by leon on 2/9/18.
*/
public class MainApplication {
public static void main(String[] args) {
Console.println("Welcome to my calculator!");
Scanner scan = new Scanner(System.in);
System.out.println("Please Enter the first number: ");
int z = scan.nextInt();

String op = Console.getStringInput("Enter an operator");

if (op.equals("sqr")) {
MainApplication.Square(z);
}
else if(op.equals("sqrt")){
MainApplication.SquareRoot(z);
}

else {

System.out.println("Please Enter the second number: ");
int y = scan.nextInt();

if (op.equals("-")) {
MainApplication.Subtraction(z, y);
}

if (op.equals("+")) {
MainApplication.Addition(z, y);
}

if (op.equals("/")){
MainApplication.Division(z, y);
}
}




/* Console.println("Welcome to my calculator!");
String s = Console.getStringInput("Enter a string");
Integer i = Console.getIntegerInput("Enter an integer");
Double d = Console.getDoubleInput("Enter a double.");

Console.println("The user input %s as a string", s);
Console.println("The user input %s as a integer", i);
Console.println("The user input %s as a d", d);
Console.println("The user input %s as a d", d); */

}
/*static void Addition(){
Scanner scan = new Scanner(System.in);
System.out.println("Please Enter Numbers: ");
int z = scan.nextInt();
System.out.println("and :");
int y = scan.nextInt();
int x = z+y;
System.out.println("Addition: "+x);


}

/* static void Subtraction(){
Scanner scan = new Scanner(System.in);
System.out.println("Please Enter Numbers: ");
int z = scan.nextInt();
System.out.println("and :");
int y = scan.nextInt();
int x = z-y;
System.out.println("Addition: "+x);
} */

static void Addition(int z, int y) {
int x = z + y;
System.out.println("The answer is " + x);
}


static void Subtraction(int z, int y){
int x = z - y;
System.out.println("The answer is " + x);
}

static void Square(int z) {
int x = z * z;
System.out.println("The answer is " + x);
}

static void SquareRoot(int z) {
double x = Math.sqrt(z);
int y = (int)x;
System.out.println("The answer is " + y);
}



static void Division(float z,float y){
float x = z / y;
System.out.println("The answer is " + x);
}

}

//adding comment to push it
3 changes: 3 additions & 0 deletions src/main/java/out/production/main/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/main/java/out/production/main/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/main/java/out/production/main/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/main/java/out/production/main/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.