Explore BrainMass

Explore BrainMass

    Attributes and Methods for Objects in Java

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    I am having problems identifing the appropriate class names, attributes and methods for the following objects. I need at least 3 attributes and 3 methods for each class.

    STUDENT
    INSTRUCTOR
    CLASS
    MAJOR

    For Example:

    Class Name
    Student

    Attributes
    socialSecurityNumber;
    studentName;
    studentDOB;

    Methods
    getStudentName();
    getTotalStudentCount();
    setStudentID(ssn, fname);

    I have part of it done but im not sure where to go from there.
    Thanks

    public class Student {

    // methods
    public void setName(String name){}
    public void getStudentName(){}
    public void setTotalStudentCount(){}
    public void getTotalStudentCount(){}
    public void setSS(String ssn){}
    public void getSS(){}

    // attrs
    String name;
    String ssn;
    String studentMajor;
    }

    © BrainMass Inc. brainmass.com February 24, 2021, 2:08 pm ad1c9bdddf
    https://brainmass.com/computer-science/java/attributes-methods-objects-java-3995

    Solution Preview

    Yes, the relationship between the four objects are very complicated. However, there's something we should remember, students choose teacher, students take course, teachers add student, teachers teach courses, courses have info of students and teachers, major has info of students.
    <br>
    <br>class Student {
    <br>
    <br> protected Faculty[] advisor;
    <br> private Course[] classes;
    <br> protected String name;
    <br> protected String ssn;
    <br> protected String major;
    <br> private int numberClasses;
    <br>
    <br>//methods:
    <br> public String GetName()
    <br> public String GetSSN()
    <br> public String GetMajor()
    <br> public String GetNumofClasses()
    <br> public void setAdvisor(Faculty ...

    Solution Summary

    A java problem is targeted.

    $2.19

    ADVERTISEMENT