Monday, November 4, 2013

Praktikum 6

import java.util.Scanner;

public class nrp5213100087{
public static void main(String[] args) {
xNRP z = new xNRP();
}
}

class xNRP {
public Scanner get = new Scanner(System.in);
public String nrp;
public Integer n = new Integer(0);
public boolean stopper=true;


public void out(String str) {
System.out.print(str);
}
public boolean error(int j) {
if(j==1) { out("Warning : Input anda salah. NRP harus berupa angka.\n"); return false;}
else
if(j==2) { out("Warning : Input anda salah. NRP harus 10 digit.\n"); return false;}
else return true;
}
public void inputNRP() {
out("Masukkan NRP : ");
nrp = get.nextLine();
if(nrp.length()!=10) stopper=error(2);
for(int i=0;i if(nrp.codePointAt(i)<48 i="" nrp.codepointat="">57)
{ stopper=error(1); break; }
}
}
public String crop() {
String res="";
res = nrp.substring(2,4);
return res;
}
public void info() {
out("\nJurusan      : ");
if(n==52) out("SI");
if(n==51) out("TC");
out("\nFakultas     : ");
if((n/10)==5) out("FTIf");
out("\nTahun Masuk  : "); out("20"+crop());
out("\nNRP          : "); out(nrp+"\n");
}

public xNRP() {
inputNRP();
if(stopper==true) {
n = n.parseInt(nrp.substring(0,2));
info();
}
}

}

No comments:

Post a Comment