70 likes | 158 Views
Syntax Tugas Pertemuan IV. public static void main(String[] args) { int bil1=3; do { System.out.print(bil1+","); bil1=bil1+4; } while(bil1<=35 ); // menggunakan Do-While while (bil1<=35){
E N D
public static void main(String[] args) { int bil1=3; do { System.out.print(bil1+","); bil1=bil1+4; } while(bil1<=35);//menggunakan Do-While while (bil1<=35){ System.out.print(bil1+","); bil1=bil1+4; // Menggunakan While } for (int a=3;a<=35;a++){ System.out.print(a+","); a=a+4; }//menggunakan For } Syntax tugaspertemuan IV No.1
public static void main(String[] args) { /** Print Pattern I */ System.out.println("Segitiga Siku-siku Kanan "); for (int i = 1; i <= 6; i++) { for (int j = 1; j <= i; j++) System.out.print(j + " "); System.out.println(); } /** Print Pattern II */ System.out.println("Segitiga Siku-siku Kiri "); for (int i = 1; i <= 6; i++) { for (int j = i; j <= 6; j++) System.out.print(" "); for (int j = i; j >=1; j--) System.out.print(j); System.out.println(); } Syntax tugaspertemuan IV No.3
/** Print Pattern III */ System.out.println("Segitiga Sama Kaki "); for(int i=1; i<=6; i++){ for(int j=1; j<=6-i; j++){ System.out.print(" "); } for(int j=1; j<=i; j++){ System.out.print(" " + j); } System.out.println();
public static void main(String[] args) { int tugas,tugas1,tugas2,tugas3,uts,uas; String input; double ips; input=JOptionPane.showInputDialog("inputkan Nilai tugas 1 anda = "); tugas1=Integer.parseInt(input); input=JOptionPane.showInputDialog("inputkan Nilai tugas 2 anda = "); tugas2=Integer.parseInt(input); input=JOptionPane.showInputDialog("inputkan Nilai tugas 3 anda = "); tugas3=Integer.parseInt(input); tugas=(tugas1+tugas2+tugas3)/3; input=JOptionPane.showInputDialog("inputkan Nilai uts anda = "); uts=Integer.parseInt(input); input=JOptionPane.showInputDialog("inputkan Nilai uas anda = "); uas=Integer.parseInt(input); ips=0.1*tugas+0.4*uts+0.5*uas; if (ips>=76){JOptionPane.showMessageDialog(null,"Grade Anda Sangat Memuaskan A "); } else if (ips<=75&ips>=66){JOptionPane.showMessageDialog(null,"Grade Anda Sudah Lumayan B "); } else if (ips<=65&ips>=56){JOptionPane.showMessageDialog(null, "Grade Anda Memang Tidak Bagus tetapi Tetap Optimis C "); } else if (ips<=55&ips>=46){JOptionPane.showMessageDialog(null,"Grade Anda Memang Mengenaskan D "); } else if (ips<=45){JOptionPane.showMessageDialog(null,"Perlu Pusing Tujuh Keliling Ini Grade Anda E Lho!!"); } } Syntax Tugaspertemuan IV no.4