0% found this document useful (0 votes)
7 views

Tugas 3

denjs

Uploaded by

dewosagethi7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Tugas 3

denjs

Uploaded by

dewosagethi7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Nama : Satrio Dewo Sagethi

NPM : 202343501703

Kelas : R3V
TUGAS3
import java.util.Scanner;

public class Tugas3 {


public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.print("Jumlah Data: ");


int jumlahData = scanner.nextInt();
scanner.nextLine();
System.out.println("---------------------------------------------------");
String[][] data = new String[jumlahData][3];

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


System.out.print("Mata Kuliah: ");
data[i][0] = scanner.nextLine();
System.out.print("Nilai Teori: ");
data[i][1] = scanner.nextLine();
System.out.print("Nilai Praktikum: ");
data[i][2] = scanner.nextLine();
System.out.println("");
}

System.out.println("---------------------------------------------------");
System.out.println("\nMata Kuliah\tTeori\tPraktikum\tRata-rata");
System.out.println("---------------------------------------------------");
for (int i = 0; i < data.length; i++) {
int teori = Integer.parseInt(data[i][1]);
int praktikum = Integer.parseInt(data[i][2]);
double rataRata = (teori + praktikum) / 2.0;
System.out.println(data[i][0] + "\t\t" + teori + "\t" + praktikum + "\t\t" +
rataRata);
}

scanner.close();
}
}

You might also like