Selasa, 22 Desember 2009

Nilai Pemrog IC





Untitled Document






































































































































N0. NAMA NIM NA
1 Adityaranda S. 0910960001-96 82.1
2 Cahya Arief Ramadhan 0910960003-96 80
3 Diantika Puspitasari 0910960005-96 77.9
4 Elly Ratna Sayekti 0910960007-96 77
5 Primanda Lusita 0910960011-96 84
6 Septyan Teguh Mahendra 0910960017-96 17
7 Ade Sumantri 0910960021-96 73.3
8 Aulia Yusiana F. 0910960027-96 83.5
9 Febe Athalia Agnar 0910960035-96 80.3
10 Isyar A. Harun 0910960043-96 83.7
11 Khoirul Sholeh 0910960045-96 82.7
12 Olive Khoirul L.M.A 0910960055-96 78
13 Raden Roro Kartika N. 0910960057-96 77.3
14 Rosiana Kurniasari 0910960062-96 79.4
15 Ayu Rachmawati 0910961001-96 77.1
16 Nanik Ulfatun Nikmah 0910961007-96 74.5
17 Tomy Febri P. 0910961009-96 82.8
18 Candra Ratna Hariyanti 0910963007-96 76.1
19 Tita Fadilah 0910963015-96 85.2
20 Nining Dyah Mustikawati 0910963025-96 78.3




Senin, 14 Desember 2009

Daftar Nilai Komputer Dasar Kimia A
































































































































No Nama NIM FINAL
1 Putri Tishana Primandari 0610920046 73
2 Fifi Nafikah 0910920010 83
3 Aris 0910920026 83
4 Devis Resita Dewi 0910920028 81
5 Indah Destiana 0910920046 87
6 Nora Witnya 0910920056 73
7 Nur Faiza 0910920058 85
8 S. Alfisyah Nur Aziza 0910920064 82
9 Sicilla Kusuma 0910920066 80
10 Aliya Fatma 0910921002 73
11 Ivatarina Wulandari 0910921006 74
12 Sarah Fitria Agung 0910921008 73
13 Ardian Retno 0910923004 81
14 Lhuhur Sheto A 0910923010 71
15 Alif Faiza R 0910923028 80
16 Fajar Rizqy M 0910923040 81
17 Juli Iffatu Rosyidah 0910923046 87
18 Megawati Sistin A 0910923050 82
19 Novia Sintesa Dara R 0910923052 86
20 Rara Anggun Mei N 0910923054 82

Minggu, 22 November 2009

Pemecahan Array


Pemecahan Array

Mula-mula kita harus membuat kelas MyArray sbb :

MyArray.java

1

public class MyArray {

private int size;

private double x[];

public MyArray(int _size)

{

size = _size;

x = new double [size];

}

public void setSize(int _size)

{

size = _size;

x = new double [size];

}

public void read()

{

System.out.print("Banyaknya data :");

int n = MyInput.inInt();

setSize(n);

int i;

for (i=0; i

{

System.out.print("Data "+(i+1)+" : ");

x[i] = MyInput.inDouble();

}

}

public void write()

{

int i;

for (i=0; i

{

System.out.println((i+1)+". "+x[i]);

}

}

public double average()

{

int i;

double total = 0;

for (i=0; i

{

total = total + x[i];

}

return total/size;

}

public void distribusiFrek()

{

int i,f1=0,f2=0,f3=0,f4=0,f5=0;

int asan=200;

for (i=0;i

if (x[i]<=20) f1++;

else if (x[i]<=40) f2++;

else if (x[i]<=60) f3++;

else if (x[i]<=80) f4++;

else if (x[i]<=100) f5++;

}

System.out.println("\n\nAda "+size+" data");

System.out.println("\nRange Frekuensi");

System.out.println("0-20 "+f1);

System.out.println("21-40 "+f2);

System.out.println("41-60 "+f3);

System.out.println("61-80 "+f4);

System.out.println("81-100 "+f5);

}

public void sort()

{

int i,j;

double temp;

System.out.println("Urutan Data : ");

for (i=0;i

for (j=i+1;j

if (x[j]

temp=x[i];

x[i]=x[j];

x[j]=temp;

}

}

System.out.println ((int)x[i]+" ");

}

System.out.println("");

}

public void statistik()

{

int i;

double total=0;

for (i=0; i

{

total = total + x[i];

}

System.out.println("\nRata-rata= "+total/size);

double maks = x[ 0 ];

for (int j=0; j

{

if ( x[j] > maks )

maks = x[j];

}

System.out.println("\nMaksimum= "+maks);

double min = x[ 0 ];

for ( int k=0; k

{

if ( x[k] <>

min = x[k];

}

System.out.println("\nMinimum= "+min);

}

}

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

Lalu kita membuat kelas MyInput.java

MyInput.java

import java.io.*;

public class MyInput {

private static InputStream in = System.in;

private static PrintStream out = System.out;

private static String buffer = null;

private static int pos = 0;

public static byte inByte()

{

return (byte)readInteger(-128L,127L);

}

public static short inShort()

{

return (short)readInteger(-32768L,32767L);

}

public static int inInt()

{

return (int)readInteger((long)Integer.MIN_VALUE,

(long)Integer.MAX_VALUE);

}

public static long inLong()

{

return readInteger(Long.MIN_VALUE, Long.MAX_VALUE);

}

public static char inChar()

{

char ch = lookChar();

while (ch == ' ' || ch == '\n')

{

readChar();

if (ch == '\n')

dumpString("",0);

ch = lookChar();

}

return readChar();

}

public static double inDouble() {

double x = 0.0;

while (true) {

String str = readRealString();

if (str.equals("")) {

errorMessage("Range " , + Double.MIN_VALUE +

" sampai " + Double.MAX_VALUE);

}

else {

Double f = null;

try { f = Double.valueOf(str); }

catch (NumberFormatException e) {

errorMessage("Range " , + Double.MIN_VALUE +

" sampai " + Double.MAX_VALUE);

continue;

}

if (f.isInfinite()) {

errorMessage("Range " , + Double.MIN_VALUE +

" sampai " + Double.MAX_VALUE);

continue;

}

x = f.doubleValue();

break;

}

}

return x;

}

private static String readRealString()

{

StringBuffer s=new StringBuffer(50);

char ch=lookChar();

while (ch == ' ' || ch == '\n') {

readChar();

if (ch == '\n')

dumpString("",0);

ch = lookChar();

}

if (ch == '-' || ch == '+') {

s.append(readChar());

ch = lookChar();

while (ch == ' ') {

readChar();

ch = lookChar();

}

}

while (ch >= '0' && ch <= '9') {

s.append(readChar());

ch = lookChar();

}

if (ch == '.') {

s.append(readChar());

ch = lookChar();

while (ch >= '0' && ch <= '9') {

s.append(readChar());

ch = lookChar();

}

}

if (ch == 'E' || ch == 'e') {

s.append(readChar());

ch = lookChar();

if (ch == '-' || ch == '+') {

s.append(readChar());

ch = lookChar();

}

while (ch >= '0' && ch <= '9') {

s.append(readChar());

ch = lookChar();

}

}

return s.toString();

}

private static long readInteger(long min, long max)

{

long x=0;

while (true) {

StringBuffer s=new StringBuffer(34);

char ch=lookChar();

while (ch == ' ' || ch == '\n') {

readChar();

if (ch == '\n')

dumpString("",0);

dumpString("",0);

ch = lookChar();

}

if (ch == '-' || ch == '+') {

s.append(readChar());

ch = lookChar();

while (ch == ' ') {

readChar();

ch = lookChar();

}

}

while (ch >= '0' && ch <= '9') {

s.append(readChar());

ch = lookChar();

}

if (s.equals("")){

errorMessage("Range integer : ", + min +

" sampai " + max);

}

else {

String str = s.toString();

try {

x = Long.parseLong(str);

}

catch (NumberFormatException e) {

errorMessage("Range integer : " , + min +

" sampai " + max);

continue;

}

if (x <> max) {

errorMessage("Range integer : ", + min +

" sampai " + max);

continue;

}

break;

}

}

return x;

}

private static void dumpString(String str, int w)

{

for (int i=str.length(); i

out.print(' ');

for (int i=0; i

if ((int)str.charAt(i) >= 0x20 &&

(int)str.charAt(i) != 0x7F)

out.print(str.charAt(i));

else if (str.charAt(i) == '\n' || str.charAt(i) ==

'\r')

newLine();

}

private static void errorMessage(String message,

String expecting)

{

newLine();

dumpString(" *** Input Salah: \n", 0);

dumpString(" *** Range: " + expecting + "\n", 0);

newLine();

dumpString("Masukkan lagi: ", 0);

readChar(); // discard the end-of-line character

}

private static char lookChar()

{

if (buffer == null || pos > buffer.length())

fillBuffer();

if (pos == buffer.length())

return '\n';

return buffer.charAt(pos);

}

private static char readChar()

{

char ch = lookChar();

pos++;

return ch;

}

private static void newLine()

{

out.println();

out.flush();

}

private static boolean possibleLinefeedPending = false;

private static void fillBuffer()

{

StringBuffer b = new StringBuffer();

out.flush();

try {

int ch = in.read();

if (ch == '\n' && possibleLinefeedPending)

ch = in.read();

possibleLinefeedPending = false;

while (ch != -1 && ch != '\n' && ch != '\r') {

b.append((char)ch);

ch = in.read();

}

possibleLinefeedPending = (ch == '\r');

if (ch == -1) {

System.out.println("*** Found an end-of-file while trying to read from standard input! ***");

System.out.println("*** Program will be terminated. *** \n");

throw new RuntimeException(" End-of-file on standard input.");

}

}

catch (IOException e) {

System.out.println(" Unexpected system error on input.");

System.out.println("Terminating program.");

System.exit(1);

}

buffer = b.toString();

pos = 0;

}

}

Apalagi ya? Oh ya! MyMenu.java :

MyMenu.java

1

public class MyMenu {

public static int getPilih()

{

int pilih;

do

{

System.out.println("\n MENU PROGRAM");

System.out.println("1. Input Data");

System.out.println("2. Tampilkan Data");

System.out.println("3. Distribusi Frekuensi");

System.out.println("4. Statistik");

System.out.println("5. Urutkan Data");

System.out.print ("Pilihan Anda : ");

pilih = MyInput.inInt();

System.out.println("");

}while ((pilih<0)||(pilih>5));

return pilih;

}

}

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

FINALNYA! Kelas Main.java!

Main.java

1

public class Main {

public static void main (String[] args) {

int pilih;

MyArray arr = new MyArray(1);

do{

pilih = MyMenu.getPilih();

switch(pilih)

{

case 1 : arr.read();break;

case 2 : arr.write();break;

case 3 : arr.distribusiFrek();break;

case 4 : arr.statistik();break;

case 5 : arr.sort();break;

}

}while (pilih!=0);

}

}

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19




















Outputnya ! :