/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mathtables;
/**
*
* @author student
*/
public class MathTables {
public static void main(String[] args) {
double a1;
double a2;
double a3;
double a4;
double a5;
double a6;
double a7;
double a8;
double a9;
double a10;
double a11;
double a12;
a1 = 1;
a2 = 1;
a3 = 1;
a4 = 1;
a5 = 1;
a6 = 1;
a7 = 1;
a8 = 1;
a9 = 1;
a10 = 1;
a11 = 1;
a12 = 1;
printCommonLogTable();
printAdditionTable ();
printTrigTables(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
}
public static void printCommonLogTable () {
double x = .5;
while (x < 10.0) {
System.out.println(x + " " + Math.log(x));
x = x + .5;
}
}
public static void printAdditionTable () {
System.out.println("+ 0 1 2 3 4 5 6 7 8 9");
System.out.println("0 0 1 2 3 4 5 6 7 8 9");
System.out.println("1 1 2 3 4 5 6 7 8 9 10");
System.out.println("2 2 3 4 5 6 7 8 8 9 11");
System.out.println("3 3 4 5 6 7 8 8 9 10 11 12");
System.out.println("4 4 5 6 7 8 9 10 11 12 13");
System.out.println("5 5 6 7 8 9 10 11 12 13 14");
System.out.println("6 6 7 8 9 10 11 12 13 14 15");
System.out.println("7 7 8 9 10 11 12 13 14 15 16");
System.out.println("8 8 9 10 11 12 13 14 15 16 17");
System.out.println("9 9 10 11 12 13 14 15 16 17 18");
}
public static void printTrigTables (double a1, double a2, double a3, double a4,
double a5, double a6, double a7, double a8, double a9, double a10, double a11,
double a12) {
// Need to print sin, cos, tan of angles between 0-360
// in 30 degree increments
// Radians = Degrees * PI / 180
System.out.print("Angle 30");
a1 = 30 * 2 * Math.PI/360;
System.out.println ("cos(" + a1 + ") is " + Math.acos(a1));
System.out.println ("sin(" + a1 + ") is " + Math.asin(a1));
System.out.println("tan(" + a1 + ") is " + Math.atan(a1));
System.out.print("Angle 60");
a2 = 60 * 2 * Math.PI/360;
System.out.println("cos(" + a2 + ") is " + Math.acos(a2)) ;
System.out.println("sin(" + a2 + ") is " + Math.asin(a2));
System.out.println("tan(" + a2 + ") is " + Math.atan(a2));
System.out.print("Angle 90");
a3 = 90 * 2 * Math.PI/360;
System.out.println("cos(" + a3 + ") is " + Math.acos(a3)) ;
System.out.println("sin(" + a3 + ") is " + Math.asin(a3));
System.out.println("tan(" + a3 + ") is " + Math.atan(a3));
System.out.print("Angle 120");
a4 = 120 * 2 * Math.PI/360;
System.out.println("cos(" + a4 + ") is " + Math.acos(a4));
System.out.println("sin(" + a4 + ") is " + Math.asin(a4));
System.out.println("tan(" + a4 + ") is " + Math.atan(a4));
System.out.print("Angle 150");
a5 = 150 * 2 * Math.PI/360;
System.out.println("cos(" + a5 + ") is " + Math.acos(a5));
System.out.println("sin(" + a5 + ") is " + Math.asin(a5));
System.out.println("tan(" + a5 + ") is " + Math.atan(a5));
System.out.print("Angle 180");
a6 = 180 * 2 * Math.PI/360;
System.out.println("cos(" + a6 + ") is " + Math.acos(a6));
System.out.println("sin(" + a6 + ") is " + Math.asin(a6));
System.out.println("tan(" + a6 + ") is " + Math.atan(a6));
System.out.print("Angle 210");
a7 = 210 * 2 * Math.PI/360;
System.out.println("cos (" + a7 + ") is " + Math.acos(a7));
System.out.println("sin (" + a7 + ") is " + Math.asin(a7));
System.out.println("tan (" + a7 + ") is " + Math.atan(a7));
System.out.print("Angle 240");
a8 = 240 * 2 * Math.PI/360;
System.out.println("cos (" + a8 + ") is " + Math.acos(a8));
System.out.println("sin (" + a8 + ") is " + Math.asin(a8));
System.out.println("tan (" + a8 + ") is " + Math.atan(a8));
System.out.print("Angle 270");
a9 = 270 * 2 * Math.PI/360;
System.out.println("cos (" + a9 + ") is " + Math.acos(a9));
System.out.println("sin (" + a9 + ") is " + Math.asin(a9));
System.out.println("tan (" + a9 + ") is " + Math.atan(a9));
System.out.print("Angle 300");
a10 = 300 * 2 * Math.PI/360;
System.out.println("cos (" + a10 + ") is " + Math.acos(a10));
System.out.println("sin (" + a10 + ") is " + Math.asin(a10));
System.out.println("tan (" + a10 + ") is " + Math.atan(a10));
System.out.print("Angle 330");
a11 = 330 * 2 * Math.PI/360;
System.out.println("cos (" + a11 + ") is " + Math.acos(a11));
System.out.println("sin (" + a11 + ") is " + Math.asin(a11));
System.out.println("tan (" + a11 + ") is " + Math.atan(a11));
System.out.print("Angle 360");
a12 = 360 * 2 * Math.PI/360;
System.out.println("cos (" + a12 + ") is " + Math.acos(a12));
System.out.println("sin (" + a12 + ") is " + Math.asin(a12));
System.out.println("tan (" + a12 + ") is " + Math.atan(a12));
}
;
}