Advertisement
pinnguyen

xuly.java

Sep 2nd, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.19 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package tamgiac;
  7.  
  8. /**
  9.  *
  10.  * @author Dinh
  11.  */
  12. import java.io.BufferedReader;
  13. import java.io.IOException;
  14. import java.io.InputStreamReader;
  15. import java.util.logging.Level;
  16. import java.util.logging.Logger;
  17.  
  18. /**
  19.  *
  20.  * @author NOBITO
  21.  */
  22. public class xuly {
  23.     static double a, b, c, chuvi, dientich, A, B, C;
  24.     public void nhap() {
  25.         try {
  26.             BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  27.             System.out.println("Nhập cạnh a:");
  28.             String s = br.readLine();
  29.             a = Double.parseDouble(s);
  30.             System.out.println("Nhập cạnh b:");
  31.             s = br.readLine();
  32.             b = Double.parseDouble(s);
  33.             System.out.println("Nhập cạnh c:");
  34.             s = br.readLine();
  35.             c = Double.parseDouble(s);
  36.             System.out.println("Nhập góc A:");
  37.             s = br.readLine();
  38.             A = Double.parseDouble(s);
  39.             System.out.println("Nhập góc B:");
  40.             s = br.readLine();
  41.             B = Double.parseDouble(s);
  42.             System.out.println("Nhập góc C:");
  43.             s = br.readLine();
  44.             C = Double.parseDouble(s);
  45.         } catch (IOException ex) {
  46.             Logger.getLogger(xuly.class.getName()).log(Level.SEVERE, null, ex);
  47.         }
  48.     }
  49. public double chuvi() {
  50.         return a + b + c;
  51.     }
  52.  
  53. public double dientich() {
  54.         double P, S;
  55.         P = chuvi() / 2;
  56.         S = Math.sqrt(P * (P - a) * (P - b) * (P - c));
  57.         return S;
  58.     }
  59. public double noitiep(){
  60.     double P, nt;
  61.     P = chuvi()/2;
  62.     nt = Math.sqrt(((P - a) * (P - b) * (P - c))/P);
  63.     return nt;
  64. }
  65. public double ngtgA(){
  66.     double P, ngtA;
  67.     P = chuvi()/2;
  68.     ngtA = P*(Math.tan(A));
  69.         return ngtA;
  70. }
  71. public double ngtgB(){
  72.     double P, ngtB;
  73.     P = chuvi()/2;
  74.     ngtB = P*(Math.tan(B));
  75.         return ngtB;
  76. }
  77. public double ngtgC(){
  78.     double P, ngtC;
  79.     P = chuvi()/2;
  80.     ngtC = P*(Math.tan(C));
  81.         return ngtC;
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement