# Thread: Write a program to compute tan (a+b) tan (a-b)

1. Member
Join Date
Jul 2011
Posts
6
Rep Power
0

## Write a program to compute tan (a+b) tan (a-b)

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

package excerise;

/**
*
* @author HARRISON
*
*/
import java.util.Scanner;
import java.lang.Math;
public class Excercise {
// Display Excercise in the output window
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
// create Scanner for input from command
double a, b;
double x;
double x2;
System.out.println("tangent in sides of tan a + b");
a=5;
b=10;
x= Math.tan((a + b) /(1-a * b));
System.out.println("tangent x = " + x);
//mathtan(x) -Tangent of x
// x2 is a double value
Scanner input = new Scanner (System.in);
// Obtain user input
//using tangent b
System.out.println("tangent in sides of tan a - b");
b=2;
x= Math.tan((a - b) / (1 + a * b));
System.out.println("tangent x = " + x);
System.out.print("The value for tan(a+b) =(tan(a)+tan(b))/(1-tan(a)*tan(b))");
x=input.nextDouble();
System.out.println("The value for tan(a-b)= (tan(a) + tan(b))/(1 + tan(a)*tan(b))");
x2= input.nextDouble();
//end of method main
// end of class tan (a + b) and tan (a-b)

}
}

( KINDLY USE THE ABOVE CODE AND RUN IT ON GUI MODE) THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!
Last edited by bestlita; 07-07-2011 at 02:51 AM.

2. Moderator
Join Date
Jul 2010
Location
California
Posts
1,641
Rep Power
10

3. A good rule of thumb is to put as much effort into writing your question here as you wish someone to put into trying to answer it. Just dumping code into the forum doesn't really help us to know how to help you does it?

4. Member
Join Date
Jul 2011
Posts
5
Rep Power
0
There is no such thing as "GUI mode" It is a lot of work to develop a GUI for an application. That said, there are lots of programs to help you, such as NetBeans IDE. Look up java swing on google, and you may find some help.

5. ( KINDLY USE THE ABOVE CODE AND RUN IT ON GUI MODE) THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!
DONE!!!!!!!!!!!!!!!!!!!!!!!!!! WHAT DID I WIN?????????????????????????

db

6. Is this a continuation from this thread? http://www.java-forums.org/new-java/...tml#post219301

kind regards,

Jos

7. Member
Join Date
Jul 2011
Posts
6
Rep Power
0

## Display the below code into a gui form or user friendly in java

A program to compute tan (a +b) (tan (a-b)
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package excerise;

/**
*
* @author ITALIAN
*
*/
import java.util.Scanner;
import java.lang.Math;
public class Excercise {
// Display Excercise in the output window
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
// create Scanner for input from command
double a, b;
double x;
double x2;
System.out.println("tangent in sides of tan a + b");
a=5;
b=10;
x= Math.tan((a + b) /(1-a * b));
System.out.println("tangent x = " + x);
//mathtan(x) -Tangent of x
// x2 is a double value
Scanner input = new Scanner (System.in);
// Obtain user input
//using tangent b
System.out.println("tangent in sides of tan a - b");
b=2;
x= Math.tan((a - b) / (1 + a * b));
System.out.println("tangent x = " + x);
System.out.print("The value for tan(a+b) =(tan(a)+tan(b))/(1-tan(a)*tan(b))");
x=input.nextDouble();
System.out.println("The value for tan(a-b)= (tan(a) + tan(b))/(1 + tan(a)*tan(b))");
x2= input.nextDouble();
//end of method main
// end of class tan (a + b) and tan (a-b)

}
}

8. Member
Join Date
Jul 2011
Posts
6
Rep Power
0

## Kindly write code below in java swing; joptionpane

Please run the program using Swing command in java. Thanks

A program to compute tan (a +b) (tan (a-b)
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package excerise;

/**
*
* @author ITALIAN
*
*/
import java.util.Scanner;
import java.lang.Math;
public class Excercise {
// Display Excercise in the output window
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
// create Scanner for input from command
double a, b;
double x;
double x2;
System.out.println("tangent in sides of tan a + b");
a=5;
b=10;
x= Math.tan((a + b) /(1-a * b));
System.out.println("tangent x = " + x);
//mathtan(x) -Tangent of x
// x2 is a double value
Scanner input = new Scanner (System.in);
// Obtain user input
//using tangent b
System.out.println("tangent in sides of tan a - b");
b=2;
x= Math.tan((a - b) / (1 + a * b));
System.out.println("tangent x = " + x);
System.out.print("The value for tan(a+b) =(tan(a)+tan(b))/(1-tan(a)*tan(b))");
x=input.nextDouble();
System.out.println("The value for tan(a-b)= (tan(a) + tan(b))/(1 + tan(a)*tan(b))");
x2= input.nextDouble();
//end of method main
// end of class tan (a + b) and tan (a-b)

}
}
Last edited by bestlita; 07-08-2011 at 07:22 AM.

9. Originally Posted by bestlita
Please run the program using Swing command in java. Thanks
]WHY SHOULD WE? WE ARE NOT YOUR FRIGGIN SLAVES!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

As others tried to bring to your attention you have to ask a question.

10. Use code tags. It's really not that difficult and it makes your code much more readable.

Why should we have to compile and run your code to find out your problem? You are here looking for help, don't expect people to bend over backwards for you. You will do the majority of the work here.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•