package teststudent;
import java.util.Scanner;
class Student{
private String name;
private int number;
private float loan_amount;
Student(String n, int nu, float l){
name = n;
number = nu;
loan_amount = l;
}
Student createStudent(){
Scanner scan = new Scanner(System.in);
System.out.println("Enter the student name\n");
String n = scan.nextLine();
System.out.println("Enter the student number\n");
int nu = scan.nextInt();
System.out.println("Enter the loan amount\n");
float amount = scan.nextFloat();
Student st = new Student(n,nu, amount);
return st;
}
}
class PostGraduate{
private String name, thesis;
private int number;
private float loan_amount;
PostGraduate(String n, int nu, float l, String t){
name = n;
number = nu;
loan_amount = l;
thesis = t;
}
PostGraduate createPostGraduate(){
Scanner scan = new Scanner(System.in);
System.out.println("Enter the student name\n");
String n = scan.nextLine();
System.out.println("Enter the student number\n");
int nu = scan.nextInt();
System.out.println("Enter the loan amount\n");
float amount = scan.nextFloat();
System.out.println("Enter the thesis\n");
String t = scan.nextLine();
PostGraduate st = new PostGraduate(n,nu, amount,t);
return st;
}
}
public class TestStudent {
public static void main(String[] args) {
}
}
Comments
Leave a comment