import java.util.Scanner;
import java.io.*;
public class Kampus
{
String Nama ;
int
Matkul,Status,Prodi;
int nind;
int nik;
int npm;
}
//sub kelas ke pertama
class dosen extends Kampus
{
Scanner
inputan= new Scanner(System.in);
public void
inputdosen()
{
dosen obj = new
dosen();
obj.inputdosen();
}
}
//sub kelas ke dua
class karyawan extends Kampus
{
Scanner
inputan= new Scanner(System.in);
public void
inputKaryawan()
{
karyawan obj1=
new karyawan();
obj1.inputKaryawan();
}
}
//sub kelas ke ketiga
class Mahasiswa extends Kampus
{
Scanner
inputan= new Scanner(System.in);
public void
inputMahasiswa()
{
Mahasiswa obj2=
new Mahasiswa();
obj2.inputMahasiswa();
}
}
//method main;
class demoKampus
{
public
static void main(String[]args)
{
Scanner
input= new Scanner(System.in);
System.out.println();
System.out.println("Nama :
Auliya Rahmah ");
System.out.println("Npm : 113112706450037 ");
System.out.println("Tugas
Prak.PBO");
System.out.println("---------------------\n
");
System.out.println("Struktur
Kampus UNAS");
System.out.println("1.
Dosen");
System.out.println("2.
Karyawan");
System.out.println("3.
Mahasiswa");
System.out.print("Pilihan
anda = ");
int
pil = Integer.parseInt(input.nextLine());
if(pil
== 1)
{
System.out.println("---------------------\n");
System.out.println("
Inheritance Kampus\n ");
System.out.println("---------------------");
System.out.println(" Data Dosen ");
System.out.println("---------------------");
System.out.print("Nama
: ");
String Nama =
input.nextLine();
System.out.print("Nind
: ");
int nind =
input.nextInt();
System.out.print("Matkul
:");
int Matkul =
input.nextInt();
}
else
if(pil == 2)
{
System.out.println("---------------------");
System.out.println(" Data Karyawan ");
System.out.println("---------------------");
System.out.print("Nama
: ");
String Nama =
input.nextLine();
System.out.print("Nik
:");
int nik = input.nextInt();
System.out.print("Status :
");
int Status= input.nextInt();
}
else
if (pil == 3)
{
System.out.println("---------------------");
System.out.println(" Data Mahasiswa ");
System.out.println("---------------------");
System.out.print("Nama
: ");
String Nama =
input.nextLine();
System.out.print("Npm
:");
int npm = input.nextInt();
System.out.print("Prodi
: ");
int Prodi= input.nextInt();
}
}
}
No comments:
Post a Comment