17.01.53.2030
S1 Teknik Informatika
Soal dalam Bentuk Flowchart
Penyelesaian:
Flowchart
Kode Program JCreator:
import java.util.*;
import java.lang.Math;
public class JavaApplication {
private static Scanner input = new Scanner(System.in);
public static void main(String[] args) {
int i;
i = 0;
String[] nama = new String[5];
double[] uts = new double[5];
double[] uas = new double[5];
double[] nilaiakhir = new double[5];
for (i = 1; i <= 5; i++) {
System.out.println("masukkan nama=");
nama[i] = input.nextLine();
System.out.println("masukkan uts=");
uts[1] = input.nextDouble();
System.out.println("masukkan uas=");
uas[i] = input.nextDouble();
nilaiakhir[i] = 0.4 * uts[i] + 0.6 * uas[i];
System.out.println("Nama:");
System.out.println(nama[i]);
System.out.println("Nilai Akhir:");
System.out.println(nilaiakhir[i]);
}
}
}
import java.lang.Math;
public class JavaApplication {
private static Scanner input = new Scanner(System.in);
public static void main(String[] args) {
int i;
i = 0;
String[] nama = new String[5];
double[] uts = new double[5];
double[] uas = new double[5];
double[] nilaiakhir = new double[5];
for (i = 1; i <= 5; i++) {
System.out.println("masukkan nama=");
nama[i] = input.nextLine();
System.out.println("masukkan uts=");
uts[1] = input.nextDouble();
System.out.println("masukkan uas=");
uas[i] = input.nextDouble();
nilaiakhir[i] = 0.4 * uts[i] + 0.6 * uas[i];
System.out.println("Nama:");
System.out.println(nama[i]);
System.out.println("Nilai Akhir:");
System.out.println(nilaiakhir[i]);
}
}
}
Jadi, program diatas adalah cara menginput nama dan nilai akhir mahasiswa menggunakan tipe data array dengan rumusan nilai akhir yang telah ditentukan seperti yang ada diatas.
0 komentar:
Posting Komentar