//Run this in the command prompt of a java capable computer, this was made by a beginner over the course of 3 hours.
import java.util.*; class RunCalculator{ public static void main (String[] args){ Scanner Scanner = new Scanner(System.in); System.out.println("Input starting number:"); double n = Scanner.nextInt(); int x = 0; String Add = "Add"; String Div = "Div"; String Mult = "Mult"; String Sub = "Sub"; String End = "End";
while (x==0){
System.out.println("Please choose method, type Add for addition, Sub for subtraction, Mult for multiplication, and Div for division, followed by a space then the next number, Ex. Add 3.");
String Meth = Scanner.next();
double i = Scanner.nextDouble();
if (Meth.equalsIgnoreCase(Add)){
n+=i;
System.out.println("your new total is " + n);}
else if (Meth.equalsIgnoreCase(Sub)){
n-=i;
System.out.println("your new total is " + n);}
else if (Meth.equalsIgnoreCase(Div)){
n/=i;
System.out.println("your new total is " + n);}
else if (Meth.equalsIgnoreCase(Mult)){
n*=i;
System.out.println("your new total is " + n);}
else{
System.out.println("Invalid input");}
}
System.exit(0); } }
Log in or sign up for Devpost to join the conversation.