1 / 7

Syntax Tugas Pertemuan IV

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){

nara
Download Presentation

Syntax Tugas Pertemuan IV

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Syntax TugasPertemuan IV

  2. 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

  3. 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

  4. OUTPUT

  5. /** 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();

  6. OUTPUT

  7. 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

More Related