Java's Calculator

Section for submitting new content to Sandbox, such as maps, code, etc.
Kids are also more than welcome to submit their work with parental permission!
java.x.beast
Member
Member
Posts: 194
Joined: August 10th, 2011, 2:35 pm
Name: Addis
IRC Username: javaxbeast
Location: Chicago, IL
Contact:

Java's Calculator

Postby java.x.beast » November 4th, 2011, 8:13 pm

Hey guys. I started working on a calculator about an hour ago. It's not that great at the moment, but it's something. Especially for an hour's worth of coding from a C++ noob. If anybody wants to test and give me some feedback/bugs, I'll be happy to link the DL later. It currently has only four properly working functions.

-Addition
-Subtraction
-Multiplication
-Division

I plan on adding for stuff like square rooting and multiplying using powers later on. This is a very small, useless project, I know. I'm just doing this so that I can get familiar with C++ in order to make CPPESB and modifications to the PAS engine. Thanks for your time.

Edit: Download link : http://sourceforge.net/projects/javasca ... e/download

-Java

Langdon99
Member
Member
Posts: 3
Joined: December 31st, 2011, 2:06 am
Name: Langdon99
IRC Username: Langdon99

Re: Java's Calculator

Postby Langdon99 » January 3rd, 2012, 3:57 am

I'm learning Java bymyself and here I am trying to make a calculator but for some reason I'm getting weird values can someone revise me.
By the way I'm using my C++ knowledge as reference I don't know if it helps with java since some things are different.

Code:
import java.util.Scanner;
public class apples {
public static void main (String args[]){

Scanner input = new Scanner (System.in);
int select = 0;
double num1=0, num2=0 , result=0;
num1 = input.nextDouble();
num2 = input.nextDouble();
result = input.nextDouble();
System.out.print("Num1 :"); System.out.print(num1); System.out.print(" Num2: "); System.out.println(num2);


System.out.print("1. Sum, 2. Subtract, 3. Multiply , 4. Divide :");
select = input.nextInt();

System.out.print(select);

if ( select ==1)
{ result = num1 + num2;
System.out.println(result);}

else if ( select ==2)
{ result = num1 - num2;
System.out.println(result); }

else if (select == 3)
{result = num1 * num2;
System.out.println(result);}

else if (select == 4)
{ result = num1 / num2;
System.out.println(result);}

else {System.out.println("Invalid");}

java.x.beast
Member
Member
Posts: 194
Joined: August 10th, 2011, 2:35 pm
Name: Addis
IRC Username: javaxbeast
Location: Chicago, IL
Contact:

Re: Java's Calculator

Postby java.x.beast » January 3rd, 2012, 12:32 pm


java.x.beast
Member
Member
Posts: 194
Joined: August 10th, 2011, 2:35 pm
Name: Addis
IRC Username: javaxbeast
Location: Chicago, IL
Contact:

Re: Java's Calculator

Postby java.x.beast » April 5th, 2012, 8:32 pm


User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

Re: Java's Calculator

Postby Sircameron » April 6th, 2012, 12:51 am

Its pretty neat! Password seems out of place, and the program stops working if 11 or more numbers are used in a single number. (Was just seeing how many numbers it could handle at once)... Still looks good though. :D

java.x.beast
Member
Member
Posts: 194
Joined: August 10th, 2011, 2:35 pm
Name: Addis
IRC Username: javaxbeast
Location: Chicago, IL
Contact:

Re: Java's Calculator

Postby java.x.beast » April 6th, 2012, 5:36 pm

Thanks :D
I've updated this project a long time ago and the password protect system is now working, complete with a function that stores the password deep inside the darkest corners of your PC for later use. I'm going to work on adding several other things including quadratic equation solver and Pythagorean Theorem solver.

-Java

Jordan Ashby
Member
Member
Posts: 16
Joined: November 15th, 2012, 1:32 pm
Name: Jordan
IRC Username: Jordy

Re: Java's Calculator

Postby Jordan Ashby » March 15th, 2013, 2:12 am

Just in case you're interested. I'm learning c++ and Ruby through Thenewboston YouTube channel. he covers a lot of different languages and the videos are well organized so it's easy to find a specific one.


Return to “Donate Content To Sandbox And The Community”

Who is online

Users browsing this forum: No registered users and 3 guests