Tugas PBO
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class mahasiswa{
String nim;
String nama;
int sks;
int by;
int total;
String kelas;
void input()throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
System.out.println("================================");
System.out.print("Masukkan NIM : ");
nim=br.readLine();
System.out.print("Masukkan Nama : ");
nama=br.readLine();
System.out.print("Jumlah SKS : ");
sks=Integer.parseInt(br.readLine());
System.out.print("Jenis Kelas : ");
kelas=br.readLine();
}
void output(){
System.out.println("================================");
System.out.println(" Hasil");
System.out.println("================================");
System.out.println("Jenis Kelas : "+ kelas);
System.out.println("NIM : "+ nim);
System.out.println("Nama : "+ nama);
System.out.println("SKS Ambil : "+ sks);
}
}
class reguler extends mahasiswa{
int by=30000;
}
class extention extends mahasiswa{
int by=40000;
}
public class kuliah{
public static void main(String[] args) throws IOException{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String x;
mahasiswa a = new mahasiswa();
reguler r = new reguler();
extention e = new extention();
do{
a.input();
a.output();
if(a.kelas.equals("R")|(a.kelas.equals("r"))){
System.out.println("Biaya Per SKS : "+ r.by);
System.out.println("Total Bayar : "+(r.by*a.sks));
}else if (a.kelas.equals("E")|(a.kelas.equals("e"))){
System.out.println("Biaya Per SKS : "+ e.by);
System.out.println("Total Bayar : "+(e.by*a.sks));
}
System.out.println("Apakah Anda Akan Menghitung Lagi ? (y/n)");
x=br.readLine();
}
while (x.equals("y")|(x.equals("Y")));
}
}
import java.io.IOException;
import java.io.InputStreamReader;
class mahasiswa{
String nim;
String nama;
int sks;
int by;
int total;
String kelas;
void input()throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
System.out.println("================================");
System.out.print("Masukkan NIM : ");
nim=br.readLine();
System.out.print("Masukkan Nama : ");
nama=br.readLine();
System.out.print("Jumlah SKS : ");
sks=Integer.parseInt(br.readLine());
System.out.print("Jenis Kelas : ");
kelas=br.readLine();
}
void output(){
System.out.println("================================");
System.out.println(" Hasil");
System.out.println("================================");
System.out.println("Jenis Kelas : "+ kelas);
System.out.println("NIM : "+ nim);
System.out.println("Nama : "+ nama);
System.out.println("SKS Ambil : "+ sks);
}
}
class reguler extends mahasiswa{
int by=30000;
}
class extention extends mahasiswa{
int by=40000;
}
public class kuliah{
public static void main(String[] args) throws IOException{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String x;
mahasiswa a = new mahasiswa();
reguler r = new reguler();
extention e = new extention();
do{
a.input();
a.output();
if(a.kelas.equals("R")|(a.kelas.equals("r"))){
System.out.println("Biaya Per SKS : "+ r.by);
System.out.println("Total Bayar : "+(r.by*a.sks));
}else if (a.kelas.equals("E")|(a.kelas.equals("e"))){
System.out.println("Biaya Per SKS : "+ e.by);
System.out.println("Total Bayar : "+(e.by*a.sks));
}
System.out.println("Apakah Anda Akan Menghitung Lagi ? (y/n)");
x=br.readLine();
}
while (x.equals("y")|(x.equals("Y")));
}
}
Comments
Post a Comment