Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose you are designing and implementing an object called \"ASUStudent\" that

ID: 2247756 • Letter: S

Question

Suppose you are designing and implementing an object called "ASUStudent" that stores student information of asu students. Each student has a first name, last name, address, gpa and fees due. Also, the student object can perform following operations Change address, set gpa, pay fees in full, and add fees, Finally, students can be created by passing the first name, last name and the address. Other data members will be set to zero. There is no default constructor for the ASUStudent. a) Draw the UML diagram that clearly represent the above ASUStudent object ASUStudent irst nane. triv last name Striny adhress doube gpa dovble fees

Explanation / Answer

import java.io.*;

class ASUStudent {

    private String firstname;
    private String lastname;
    private String address;
    private double gpa;
    private double fees;
    public ASUStudent(String fname, String lname, String addr){
        firstname = fname;
        lastname = lname;
        address = addr;
        gpa = 0;
        fees = 0;
    }
    public void changeAddress(String a){
        address = a;
    }
    public void setGpa(double a){
        gpa = a;
    }
    public void payFees(){
        fees = 0;
    }
    public void addFees(double a){
        fees = a;
    }
    public void disp(){
        System.out.println("Firstname:" + firstname);
        System.out.println("Lastname:" + lastname);
        System.out.println("Address:" + address);
        System.out.println("Fees:" + fees);
        System.out.println("GPA:" + gpa);
    }

}

public class DemoASUStudent {
    public static void main(String[] args){

          ASUStudent stu = new ASUStudent("John", "Smith", "Newyork");
          stu.disp();
          stu.setGpa(3.5);
          stu.addFees(89.5);
          stu.changeAddress("LA");
          System.out.println();
          stu.disp();         

    }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote