Question #246573

POSTGRADUATE CLASS Write the PostGraduate class as per the class diagram. Remember to call the super class methods or constructors as needed. show() method This method is void and displays the details of a PostGraduate object as follows: Student details Name: Mpho Student number: 201812345 Loan amount: 10000.0 Thesis: I do not know Code the method interest(). This method returns a double value calculated as follows: loanAmount times 10%.

Expert's answer



package postgraduate;




public class POSTGRADUATE {
private String thesis, name;
private int number;
private double amount;
POSTGRADUATE(String t, String n, int nu, double a){
    thesis = t;
    name = n;
    number = nu;
    amount = a;
}
    void show(){
        System.out.printf("Name: %s\nStudent Number: "
                + "%d\nLoan Amount: %f\nThesis: %s", name, number, amount, thesis);
    }
    
    double interest(){
        return amount * 0.1;
    }
    public static void main(String[] args) {
    POSTGRADUATE p =    new POSTGRADUATE("I do not know","Mpho", 201812345, 10000.0);
    p.show();
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS