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

• 07-07-2011, 01:48 AM
bestlita
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!!!!!!!!!!!!!!!!!!!!!!!!!!
• 07-07-2011, 02:05 AM
doWhile
• 07-07-2011, 03:26 AM
Fubarable
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?
• 07-07-2011, 05:48 AM
htuy
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.
• 07-07-2011, 08:19 AM
DarrylBurke
Quote:

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

db
• 07-07-2011, 09:15 AM
JosAH
Is this a continuation from this thread? http://www.java-forums.org/new-java/...tml#post219301

kind regards,

Jos
• 07-08-2011, 06:17 AM
bestlita
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)

}
}
• 07-08-2011, 06:18 AM
bestlita
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)

}
}
• 07-08-2011, 06:38 AM
Junky
Quote:

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.
• 07-08-2011, 06:49 AM
sunde887
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.
• 07-09-2011, 04:25 AM
Fubarable
Locking this thread. It's obviously going no-where.