Java Calculator

How can i make a gui for my code. I prefer using Netbeans . in in gui.

Page 1 of 1

5 Replies - 5454 Views - Last Post: 19 June 2009 - 08:13 PM Rate Topic: -----

#1 iceangelfire17  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 28-November 08

Java Calculator

Posted 19 June 2009 - 07:37 AM

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

 
import java.math.*;




public class Method {
	
	private double add,subtract,divide,multiply;
	private double SqRot,Sqr,cuber;
	private double sin,cos,tan;
   
	
	
	public double getAdd() {
		return add;
	}
	
	public double getSubtract() {
		return subtract;
	}

	public double getMultiply() {
		return multiply;
	}
	public double getDivide() {
		return divide;
	}
	public double getSqRot(){
		return SqRot;
	}
	
	public double getSqr(){
		return Sqr;
	}
	public double getcuber(){
		return cuber;
	}
	public double getSin(){
		return sin;
	}
	public double getCos(){
		return cos;
	}
	public double getTan(){
		return tan;
	}
	public void setAdd(double add1, double add2) {
		this.add = add1 + add2;
	}

	public void setDivide(double divide1 , double divide2) {
		this.divide = divide1 / divide2;
	}

	public void setSubtract(double sub1 , double sub2) {
		this.subtract = sub1 - sub2;
	}

	public void setMultiply(double mult1 , double mult2) {
		this.multiply = mult1 * mult2;
	}
	public void setSqRot(double SqRot){
		this.SqRot = Math.sqrt(SqRot);
	}
	
	public void setSqr(double Sqr){
		this.Sqr = Sqr* Sqr;
	}
	public void setCuber(double cuber){
		this.cuber = cuber / cuber / cuber;
	}
	public void setSin(double sin){
		this.sin = Math.sin(sin);
	}
	public void setCos(double cos){
		this.cos = Math.cos(cos);
	}
	public void setTan(double cos){
		this.tan = Math.tan(tan);
	}
   
	
	

}


*Mod Edit: Added code tags: :code:

Is This A Good Question/Topic? 0
  • +

Replies To: Java Calculator

#2 xclite  Icon User is offline

  • LIKE A BOSS
  • member icon


Reputation: 894
  • View blog
  • Posts: 3,159
  • Joined: 12-May 09

Re: Java Calculator

Posted 19 June 2009 - 07:40 AM

Please post your question in the body, not the subject. We can't read the whole question if it's the title. Also, please post your code inside of code tags.
Was This Post Helpful? 0
  • +
  • -

#3 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Java Calculator

Posted 19 June 2009 - 10:02 AM

Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:
  • Post the code you're having problems with
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do
  • Post your question in the body of your post, not the description field

Was This Post Helpful? 0
  • +
  • -

#4 Fuzzyness  Icon User is offline

  • Comp Sci Student
  • member icon

Reputation: 669
  • View blog
  • Posts: 2,438
  • Joined: 06-March 09

Re: Java Calculator

Posted 19 June 2009 - 04:05 PM

I think he wants to know how to make that class a gui and how to make it function. If you are using netbeans, that is a drag and drop it ist anymore simpler then that. then you need to figure out the logic and code for it.

Netbeans = drag and drop do it for you generated code, nothing we can do until you run into errors after trying.

Goodluck
Was This Post Helpful? 0
  • +
  • -

#5 iceangelfire17  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 28-November 08

Re: Java Calculator

Posted 19 June 2009 - 07:02 PM

there is no problem with the code,. my only problem is how i make a GUI with my code
Was This Post Helpful? 0
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8327
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Java Calculator

Posted 19 June 2009 - 08:13 PM

I suggest a GridLayout() for a calculator
or you really know nothing about GUI ?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1