Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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 tamgiac;
- /**
- *
- * @author Dinh
- */
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- /**
- *
- * @author NOBITO
- */
- public class xuly {
- static double a, b, c, chuvi, dientich, A, B, C;
- public void nhap() {
- try {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Nhập cạnh a:");
- String s = br.readLine();
- a = Double.parseDouble(s);
- System.out.println("Nhập cạnh b:");
- s = br.readLine();
- b = Double.parseDouble(s);
- System.out.println("Nhập cạnh c:");
- s = br.readLine();
- c = Double.parseDouble(s);
- System.out.println("Nhập góc A:");
- s = br.readLine();
- A = Double.parseDouble(s);
- System.out.println("Nhập góc B:");
- s = br.readLine();
- B = Double.parseDouble(s);
- System.out.println("Nhập góc C:");
- s = br.readLine();
- C = Double.parseDouble(s);
- } catch (IOException ex) {
- Logger.getLogger(xuly.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- public double chuvi() {
- return a + b + c;
- }
- public double dientich() {
- double P, S;
- P = chuvi() / 2;
- S = Math.sqrt(P * (P - a) * (P - b) * (P - c));
- return S;
- }
- public double noitiep(){
- double P, nt;
- P = chuvi()/2;
- nt = Math.sqrt(((P - a) * (P - b) * (P - c))/P);
- return nt;
- }
- public double ngtgA(){
- double P, ngtA;
- P = chuvi()/2;
- ngtA = P*(Math.tan(A));
- return ngtA;
- }
- public double ngtgB(){
- double P, ngtB;
- P = chuvi()/2;
- ngtB = P*(Math.tan(B));
- return ngtB;
- }
- public double ngtgC(){
- double P, ngtC;
- P = chuvi()/2;
- ngtC = P*(Math.tan(C));
- return ngtC;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement