# Java Calculator

Page 1 of 1

## 5 Replies - 9956 Views - Last Post: 19 June 2009 - 08:13 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=110858&amp;s=f0b462d3cede768182f03819daf37163&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 iceangelfire17

Reputation: 0
• 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 SqRot,Sqr,cuber;
private double sin,cos,tan;

}

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 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);
}

}
```

Is This A Good Question/Topic? 0

## Replies To: Java Calculator

### #2 xclite

• I wrote you an code

Reputation: 1266
• Posts: 4,064
• 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.

### #3 NickDMax

Reputation: 2255
• 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

### #4 Fuzzyness

• Comp Sci Student

Reputation: 669
• 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

### #5 iceangelfire17

Reputation: 0
• 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

### #6 pbl

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

Reputation: 8378
• Posts: 31,956
• 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 ?