Hitung Statistik Dengan Program Java
package fungsi_statistik; import java.util.*; import java.lang.ArrayIndexOutOfBoundsException; public class Fungsi_statistik {
/*Method Hitung Akar 2*/
public static double hitungAkar_2(double bil){ double akar, akarBaru, galat; akar= bil; galat = akar ; while( ****){ akarBaru = ********; galat = akar - akarBaru ; akar = akarBaru ; } return akar; }
/*Method Hitung Sigma*/
public static double sigma (int ulang,int []bil) { int sigma,i; sigma = 0; for (************) { sigma = sigma + bil[i]; } return sigma; }
/*Method Hitung Rerata*/
public static double rerata(double sigma, int ulang) { double rerata; rerata = sigma / ulang; return rerata; }
/*Method Hitung Varians*/
public static double varians (int ulang, double rerata, int []bil) { int i; double varians = 0; for (*******) { varians = **********; } varians /= (ulang -1); return varians; }
/*Method Hitung Standar Deviasi*/
public static double stdev (double varians, double hitungAkar_2) { double stdev; stdev = hitungAkar_2(varians); return stdev; }
/*Method Hitung Minimal*/
public static double minimal (int ulang, int [] data) { int i; double minimal, maksimal; minimal = 0; maksimal = 0; maksimal = data[0]; minimal = data[0]; for (*******) { if(********) { maksimal = data[i]; } else if (***********) { minimal = data[i]; } } return minimal; }
/*Method Hitung Maksimal*/
public static double maksimal (int ulang, int [] data) { int i; double minimal, maksimal; minimal = 0; maksimal = 0; maksimal = data[0]; minimal = data[0]; for (************) { if(*************) { maksimal = data[i]; } else if (*********) { minimal = data[i]; } } return maksimal; }
/*Method Hitung Faktorial*/
public static int Faktorial (int bilangan){ int angka, count, faktor, hitung; angka = bilangan; for (********) { } return faktor; }
/*Method Segitiga Pascal*/
public static int segitigaPascal(int n, int r) { int kurang, combinasi; kurang = n - r; combinasi = Faktorial(n) / (Faktorial(r) * Faktorial(kurang) ); return combinasi; }
/*Method Program Utama*/
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int ulang, baris,masuk,kolom; double sigma,rerata,varians,stdev,minimal,maksimal,hitungAkar2; System.out.println("+--------------------------------------+"); System.out.println("| Wellcome To My Program |"); System.out.println("+--------------------------------------+"); System.out.println("| |"); System.out.println("| |"); System.out.println("| |"); System.out.println("+--------------------------------------+"); System.out.println("| Program Statistika |"); System.out.println("+--------------------------------------+"); System.out.println(""); System.out.print("Masukkan Nama Anda = "); String nama = sc.nextLine(); System.out.println(""); do { System.out.print("Masukkan perulangan = "); ulang = sc.nextInt(); } while(ulang <= 0 || ulang > 100); int [] data = new int [100]; for (**********) { System.out.print("Bilangan ke- "+ baris +" = "); data[baris] = sc.nextInt(); } System.out.println(""); hitungAkar2 = hitungAkar_2(ulang); sigma = sigma(ulang,data); rerata = rerata(sigma,ulang); varians = varians(ulang,rerata, data); stdev = stdev(varians, hitungAkar2); minimal = minimal(ulang, data); maksimal = maksimal(ulang, data); System.out.printf("Nama User Pengguna Saudara/i %s \n" , nama); System.out.printf("Sigma Data = %7.2f \n", sigma); System.out.printf("Rerata = %7.2f \n", rerata); System.out.printf("Varians = %7.2f \n", varians); System.out.printf("Standart Dev = %7.2f \n", stdev); System.out.printf("Nilai Maksimum = %7.2f \n", maksimal); System.out.printf("Nilai Minimum = %7.2f \n", minimal); System.out.println(""); System.out.println(""); System.out.println("+--------------------------------------+"); System.out.println("| Program Sortir |"); System.out.println("+--------------------------------------+"); System.out.println(""); System.out.println(""); System.out.println(""); System.out.println("+--------------------------------------+"); System.out.println("| Program Segitiga Pascal |"); System.out.println("+--------------------------------------+"); do { System.out.printf ("Masukkan Angka Faktoria = "); masuk = sc.nextInt(); }while(masuk <= 2 ); for (**********************) { for (**********************)
{ for (**********************) {
System.out.printf("%5d",(int)segitigaPascal(baris, kolom)); } System.out.println(""); } } System.out.println(""); System.out.println(""); System.out.println(""); System.out.println("+--------------------------------------+"); System.out.println("| 2020 (Java) Skuy Replay |"); System.out.println("+--------------------------------------+"); System.out.println(""); } }
Jika Ingin Mendownload Source Code Yang Lebih lengkap Bisa Langsung KLik Link Di Bawah ini
DOWNLOAD SC