Вы находитесь на странице: 1из 8

Nama : Diar Gustianto

NIm : 2017230104

Tif B Malam

NO1: 1&2

/*

* 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 javaapplication3;

/**

* @author diar

*/

import java.util.Scanner;

public class JavaApplication3 {


public static void main(String[] args) {

String nama,grade;

int n1,n2,n3 ;

double m1,m2,m3 ,mm;

Scanner input = new Scanner(System.in);

System.out.println(" Prog Nilai Ahir ***");

System.out.print("Nama Siswa : " );

nama =input.nextLine();

System.out.print("Nilai Keaktifan : ");

n1=input.nextInt();

System.out.print("Nilai Tugas: ");

n2=input.nextInt();

System.out.print("Nilai Ujian : ");

n3=input.nextInt();

m1= 0.2 * n1;

m2= 0.3 * n2;

m3= 0.4 * n3;

mm= m1+m2+m3;

if(mm >=80)

{
grade= "A" ;

else if (mm >=70)

grade= "B" ;

else if (mm >=59)

grade= "C" ;

else if (mm >=50)

grade= "D" ;

else

grade="E" ;

System.out.println("Siswa yang bernama = " + nama + " ");

System.out.println("Dengan Nilai Persentasi Yang dihasilkan" );

System.out.println("Nilai Keaktifan * 20% = " + (int)m1);

System.out.println ("Nilai Tugas * 30% = " + (int)m2 );

System.out.println("Nilai Ujian * 50% = " + (int)m3 );


System.out.print("Jadi Siswa yang bernama " + nama + " ");

System.out.println("memperoleh nilai akhir sebesar " + mm);

System.out.println("Grade nilai yang didapat adalah " + " " + grade);

NO2

/*

* 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 javaapplication4;

/**

*
* @author diar

*/

import java.util.Scanner;

public class JavaApplication4 {

public static void main(String[] args) {

Scanner bilangan = new Scanner(System.in);

int ganjil,awal,akhir,jumlah=0;

System.out.println (" DIar Gustianto ");

System.out.print("Masukkan Nilai Awal : ");awal= bilangan.nextInt();

System.out.print("Masukkan Nilai Akhir : ");akhir= bilangan.nextInt();

System.out.print("Deret Bilangan Ganjilnya = ");

for(ganjil=awal;ganjil<=akhir;ganjil++){

if (ganjil % 2==1)

jumlah=jumlah+ganjil;

System.out.print(ganjil + " ");

}}

System.out.println();

System.out.println("Jumlah Deret Bilangan Ganjil Adalah = "+ jumlah + " ");

NO 3 : A&B

A:
/*

* 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 javaapplication8;

/**

* @author diar

*/

import java.util.Scanner;

public class JavaApplication8 {

public static void main(String[] args) {

// TODO code application logic here

System.out.println (" Diar GUstianto");


int [][]data = {{100, 159, 230}, {500,125,150}, {210,125,156}};

Scanner input = new Scanner(System.in);

for(int i=0;i<3;i++){

for(int a=0;a<3;a++){

System.out.println("output baris " + i + " dengan kolom " + a + " adalah " + data[i][a]);

B:

/*

* 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 javaapplication7;

/**

*
* @author diar

*/

import java.util.Scanner;

public class JavaApplication7 {

public static void main(String[] args) {

// TODO code application logic here

System.out.println (" Diar Gustianto ");

int [][]data = new int [3][3];

Scanner input = new Scanner(System.in);

for(int i=0;i<3;i++){

for(int a=0;a<3;a++){

System.out.println("masukkan baris " + i + " dengan kolom " + a);

data[i][a] = input.nextInt();

for(int i=0;i<3;i++){

for(int a=0;a<3;a++){

System.out.println("output baris " + i + " dengan kolom " + a + " adalah " + data[i][a]);

Вам также может понравиться