NIM : 17.01.53.2030
Contoh Soal :
a. nilai rata-rata dan nilai akhir
b. nilai terendah dari nilai akhir
c. nilai tertinggi dari nilai akhir
Penyelesaian dengan Flowchart :
Penyelesaian Kode Program menggunakan 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];
double nilaitotal;
nilaitotal = 0;
double nilairerata;
double nilaimax;
nilaimax = 0;
double nilaimin;
nilaimin = 100;
for (i = 0; i <= 4; i++) {
nama[i] = input.nextLine();
uts[i] = input.nextDouble();
uas[i] = input.nextDouble();
nilaiakhir[i] = 0.4 * uts[i] + 0.6 * uas[i];
System.out.println(nama[i]);
System.out.println(nilaiakhir[i]);
nilaitotal = nilaitotal + nilaiakhir[i];
if (nilaimax < nilaiakhir[i]) {
nilaimax = nilaiakhir[i];
}
if (nilaimin > nilaiakhir[i]) {
nilaimin = nilaiakhir[i];
}
}
nilairerata = nilaitotal / i;
System.out.println(nilairerata);
System.out.println(nilaimax);
System.out.println(nilaimin);
}
}
JCreator
TERIMAKASIH
0 komentar:
Posting Komentar