Class Teedcalculator:
package teedcalculator;
import static teedcalculator.Oparetor.tand;// to access all static Tand of a class
import static teedcalculator.Oparetor.tan;// to access all static Tan of a class
import static teedcalculator.Oparetor.cost;// to access all static Cost of a class
import static teedcalculator.Oparetor.cosd;// to access all static Cosd of a class
import static teedcalculator.Oparetor.degree2;// to access all static Degree of a class
import static teedcalculator.Oparetor.divide;// to access all static divide of a class
import static teedcalculator.Oparetor.minus;// to access all static minus of a class
import static teedcalculator.Oparetor.modulo;// to access all static modulo of a class
import static teedcalculator.Oparetor.multiply;// to access all static multiply of a class
import static teedcalculator.Oparetor.sin;// to access all static sin of a class
import static teedcalculator.Oparetor.sind;// to access all static sind of a class
import static teedcalculator.Oparetor.square2;// to access all static square2 of a class
import static teedcalculator.Oparetor.square3;// to access all static square3 of a class
import static teedcalculator.Oparetor.squares2;// to access all static squares2 of a class
import static teedcalculator.Oparetor.squares3;// to access all static squares3 of a class
import static teedcalculator.Oparetor.sum;// to access all static sum of a class
import java.util.Scanner;// Import the Scanner class
/**
*
* @author HOANG LIHUO
*/
public class Teedcalculator {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
double sum , divide , subtract , multiplied , remainder;
int a, b, c , d , x , radian , ch ;
System.out.println("\nExercise Lab3");
System.out.print("2 / ");
System.out.println("A- Sum= " +sum(a,b));// out function sum
System.out.println("B- Divide= " +divide(a,b));// out function divide
System.out.println("C- Minus= " +minus(a,b));//out function minus
System.out.println("D- Multiply= " +multiply(a,b));// out function multiply
System.out.println("E- Modulo= " +modulo(a,b));//out function modulo
System.out.print("3 / ");
System.out.println( "A- (radian)Sin(X)= "+ sin (x));//out function sin
System.out.println( "B- (degrees)Sind(X)= "+ sind (x));//out function sind
System.out.println( "C- (radian)cost(X)= "+ cost (x));//out function cost
System.out.println( "D- (degrees)cosd(X)= "+ cosd(x)); //out function cosd
System.out.println( "E- (redian)tan(X)= "+ tan(x)); //out function tan
System.out.println( "F- (degrees)tand(X)= "+ tand(x));//out function tand
System.out.println( "G- square2= "+ square2(x)); //out function square2
System.out.println( "H- square2= "+ squares2(x)); //out function squares2
System.out.println( "I- square3= "+ square3(x)); //out function square3
System.out.println( "J- square3= "+ squares3(x)); //out function squares3
System.out.println( "K- radian= "+ degree2(radian)); //out function degree2
}
}
Class Oparetor:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package teedcalculator;
/**
*
* @author HOANG LIHUO
*/
public class Oparetor {
/* functions sum
* @param x
* @param y
* @return
*/
public static int sum(int x , int y) {
/*is a built-in math function in java which returns the value of the long argument.
It throws an exception if the result overflows an int.As toIntExact(long value) is static,
so object creation is not required.*/
int sum = x+y;
return sum;
}
/* functions sum
* @ param x
* @ param y
return */
public static double divide(int x , int y) {
double divide =((double) x/y);
return divide;
}
/* functuions divide
* @param x
* @param y
* @return
*/
public static int minus(int x , int y) {
int minus =( x-y);
return minus;
}
/* functuions minus
* @param x
* @param y
* @return
*/
public static int multiply(int x , int y) {
int multiply =( x*y);
return multiply;
}
/* functuions multiply
* @param x
* @param y
* @return
*/
public static int modulo(int x , int y) {
int modulo =( x%y);
return modulo;
}
/* functuions modulo
* @param x
* @param y
* @return
*/
public static float sin(int radian) {
float sin = (float) Math.sin(Math.toIntExact(radian));
return sin;
}
/* convert radian to degree
* sin() method to get the sin
* @param degree
* @return
*/
public static float sind(int degree) {
/*is a built-in math function in java which returns the value of the long argument.
It throws an exception if the result overflows an int.As toIntExact(long value) is static,
so object creation is not required.*/
float sind = (float)Math.sin( Math.toRadians(degree)) ;
return sind;
/*The toIntExact(long value) returns the value of the long argument;
throwing an exception if the value overflows an int.*/
}
/* convert radian to radian
* cost() method to get the cost
* @param radian
* @return
*/
public static float cost(int radian) {
float cost = (float) Math.cos(Math.toIntExact(radian));
return cost;
/* The cos(float a) returns the cosine of the method argument value.*/
}
/* convert radian to degree
* cost() method to get the cost
* @param degree
* @return
*/
public static double cosd(double degree) {
double cosd = (double)Math.cos( Math.toRadians(degree)) ;
return cosd;
/* convert radian to degree
* cosd() method to get the cosd
* @param degree
* @return
*/
}
public static float tan(int radian) {
float tan = (float) Math.tan(Math.toIntExact(radian));
return tan;
/* convert radian to degree
* tan() method to get the tan
* @param degree
* @return
*/
}
public static double tand(double degree) {
double tand= (double)Math.tan( Math.toRadians(degree)) ;
return tand;
/* convert radian to degree
* tand() method to get the tand
* @param degree
* @return
*/
}
public static long square2(long x) {
long square=(long) Math.pow(x,2);
return square;
/* convert radian to degree
* square2() method to get the square2
* @param degree
* @return
*/
}
public static double squares2(double x) {
double square= (double)Math.pow(x,2);
return square;
/* convert radian to degree
* squares2() method to get the squares2
* @param degree
* @return
*/
}
public static long square3(long x) {
long square= (long)Math.pow(x,3);
return square;
/* convert radian to degree
* square3() method to get the square3
* @param degree
* @return
*/
}
public static double squares3(double x) {
double square= (double)Math.pow(x,3);
return square;
/* convert radian to degree
* squares3() method to get the squares3
* @param degree
* @return
*/
}
public static double degree2(double degree) {
double radian= (double)(Math.toRadians((double) degree));
return radian;
/* convert radian to degree
* degree2() method to get the degree2
* @param degree
* @return
*/
}
}
package teedcalculator;
import static teedcalculator.Oparetor.tand;// to access all static Tand of a class
import static teedcalculator.Oparetor.tan;// to access all static Tan of a class
import static teedcalculator.Oparetor.cost;// to access all static Cost of a class
import static teedcalculator.Oparetor.cosd;// to access all static Cosd of a class
import static teedcalculator.Oparetor.degree2;// to access all static Degree of a class
import static teedcalculator.Oparetor.divide;// to access all static divide of a class
import static teedcalculator.Oparetor.minus;// to access all static minus of a class
import static teedcalculator.Oparetor.modulo;// to access all static modulo of a class
import static teedcalculator.Oparetor.multiply;// to access all static multiply of a class
import static teedcalculator.Oparetor.sin;// to access all static sin of a class
import static teedcalculator.Oparetor.sind;// to access all static sind of a class
import static teedcalculator.Oparetor.square2;// to access all static square2 of a class
import static teedcalculator.Oparetor.square3;// to access all static square3 of a class
import static teedcalculator.Oparetor.squares2;// to access all static squares2 of a class
import static teedcalculator.Oparetor.squares3;// to access all static squares3 of a class
import static teedcalculator.Oparetor.sum;// to access all static sum of a class
import java.util.Scanner;// Import the Scanner class
/**
*
* @author HOANG LIHUO
*/
public class Teedcalculator {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
double sum , divide , subtract , multiplied , remainder;
int a, b, c , d , x , radian , ch ;
System.out.println("\nExercise Lab3");
System.out.print("2 / ");
System.out.println("A- Sum= " +sum(a,b));// out function sum
System.out.println("B- Divide= " +divide(a,b));// out function divide
System.out.println("C- Minus= " +minus(a,b));//out function minus
System.out.println("D- Multiply= " +multiply(a,b));// out function multiply
System.out.println("E- Modulo= " +modulo(a,b));//out function modulo
System.out.print("3 / ");
System.out.println( "A- (radian)Sin(X)= "+ sin (x));//out function sin
System.out.println( "B- (degrees)Sind(X)= "+ sind (x));//out function sind
System.out.println( "C- (radian)cost(X)= "+ cost (x));//out function cost
System.out.println( "D- (degrees)cosd(X)= "+ cosd(x)); //out function cosd
System.out.println( "E- (redian)tan(X)= "+ tan(x)); //out function tan
System.out.println( "F- (degrees)tand(X)= "+ tand(x));//out function tand
System.out.println( "G- square2= "+ square2(x)); //out function square2
System.out.println( "H- square2= "+ squares2(x)); //out function squares2
System.out.println( "I- square3= "+ square3(x)); //out function square3
System.out.println( "J- square3= "+ squares3(x)); //out function squares3
System.out.println( "K- radian= "+ degree2(radian)); //out function degree2
}
}
Class Oparetor:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package teedcalculator;
/**
*
* @author HOANG LIHUO
*/
public class Oparetor {
/* functions sum
* @param x
* @param y
* @return
*/
public static int sum(int x , int y) {
/*is a built-in math function in java which returns the value of the long argument.
It throws an exception if the result overflows an int.As toIntExact(long value) is static,
so object creation is not required.*/
int sum = x+y;
return sum;
}
/* functions sum
* @ param x
* @ param y
return */
public static double divide(int x , int y) {
double divide =((double) x/y);
return divide;
}
/* functuions divide
* @param x
* @param y
* @return
*/
public static int minus(int x , int y) {
int minus =( x-y);
return minus;
}
/* functuions minus
* @param x
* @param y
* @return
*/
public static int multiply(int x , int y) {
int multiply =( x*y);
return multiply;
}
/* functuions multiply
* @param x
* @param y
* @return
*/
public static int modulo(int x , int y) {
int modulo =( x%y);
return modulo;
}
/* functuions modulo
* @param x
* @param y
* @return
*/
public static float sin(int radian) {
float sin = (float) Math.sin(Math.toIntExact(radian));
return sin;
}
/* convert radian to degree
* sin() method to get the sin
* @param degree
* @return
*/
public static float sind(int degree) {
/*is a built-in math function in java which returns the value of the long argument.
It throws an exception if the result overflows an int.As toIntExact(long value) is static,
so object creation is not required.*/
float sind = (float)Math.sin( Math.toRadians(degree)) ;
return sind;
/*The toIntExact(long value) returns the value of the long argument;
throwing an exception if the value overflows an int.*/
}
/* convert radian to radian
* cost() method to get the cost
* @param radian
* @return
*/
public static float cost(int radian) {
float cost = (float) Math.cos(Math.toIntExact(radian));
return cost;
/* The cos(float a) returns the cosine of the method argument value.*/
}
/* convert radian to degree
* cost() method to get the cost
* @param degree
* @return
*/
public static double cosd(double degree) {
double cosd = (double)Math.cos( Math.toRadians(degree)) ;
return cosd;
/* convert radian to degree
* cosd() method to get the cosd
* @param degree
* @return
*/
}
public static float tan(int radian) {
float tan = (float) Math.tan(Math.toIntExact(radian));
return tan;
/* convert radian to degree
* tan() method to get the tan
* @param degree
* @return
*/
}
public static double tand(double degree) {
double tand= (double)Math.tan( Math.toRadians(degree)) ;
return tand;
/* convert radian to degree
* tand() method to get the tand
* @param degree
* @return
*/
}
public static long square2(long x) {
long square=(long) Math.pow(x,2);
return square;
/* convert radian to degree
* square2() method to get the square2
* @param degree
* @return
*/
}
public static double squares2(double x) {
double square= (double)Math.pow(x,2);
return square;
/* convert radian to degree
* squares2() method to get the squares2
* @param degree
* @return
*/
}
public static long square3(long x) {
long square= (long)Math.pow(x,3);
return square;
/* convert radian to degree
* square3() method to get the square3
* @param degree
* @return
*/
}
public static double squares3(double x) {
double square= (double)Math.pow(x,3);
return square;
/* convert radian to degree
* squares3() method to get the squares3
* @param degree
* @return
*/
}
public static double degree2(double degree) {
double radian= (double)(Math.toRadians((double) degree));
return radian;
/* convert radian to degree
* degree2() method to get the degree2
* @param degree
* @return
*/
}
}
Comments
Post a Comment