This document contains the source code for a Java program that calculates a student's grade point average (IP) based on the courses taken. The program prompts the user to enter the number of courses, then collects the name, credits, and grade for each course. It calculates the IP by summing the product of each grade and credits, dividing by the total credits. The program outputs the name, credits, grade, and grade letter for each course, as well as the final IP.
This document contains the source code for a Java program that calculates a student's grade point average (IP) based on the courses taken. The program prompts the user to enter the number of courses, then collects the name, credits, and grade for each course. It calculates the IP by summing the product of each grade and credits, dividing by the total credits. The program outputs the name, credits, grade, and grade letter for each course, as well as the final IP.
This document contains the source code for a Java program that calculates a student's grade point average (IP) based on the courses taken. The program prompts the user to enter the number of courses, then collects the name, credits, and grade for each course. It calculates the IP by summing the product of each grade and credits, dividing by the total credits. The program outputs the name, credits, grade, and grade letter for each course, as well as the final IP.
JURUSAN TEKNIK INFORMATIKA STMIK HANDAYANI MAKASSAR 2013
import javax.swing.JOptionPane; public class Tugas_IP { public static void main(String[] args) { String JumMataKuliah = JOptionPane.showInputDialog(null,"Masukkan Jumlah Mata Kuliah : "); int jum = Integer.parseInt(JumMataKuliah);
String[] MataKuliah = new String[jum]; int[] SKS = new int[jum]; float[] nilai = new float[jum]; String[] nilaiHuruf = new String[jum];
int b =0; for (int a=0 ; a < jum ; a++) { b = a + 1; MataKuliah[a] = JOptionPane.showInputDialog(null,"Nama Mata Kuliah - "+ b +" : "); SKS[a] = Integer.parseInt(JOptionPane.showInputDialog(null,"SKS Mata Kuliah - "+ b +" : ")); nilai[a] = Float.parseFloat(JOptionPane.showInputDialog(null,"Nilai Mata Kuliah - "+ b +" : "));
if (nilai[a] >= 4) { nilaiHuruf[a] = "A";} else if (nilai[a] >= 3) nilaiHuruf[a] = "B"; else if (nilai[a] >= 2) nilaiHuruf[a] = "C"; else if (nilai[a] >= 1) nilaiHuruf[a] = "D"; else nilaiHuruf[a] = "E"; }