Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005
    Posts
    11

    Unanswered: Java code:explain?!

    guys will somebody please tell me what the basic steps for this inheritance is?

    I got this code as a sample and have an exam on JAVA tommorrow!

    Please translate in real world terms as to why each step is necessary!

    thanks.
    IRISHMAN!

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

    //Declare three BISStudent objects

    BISStudent brian = new BISStudent("IS2211", "Business Modelling, Systems Analysis, Systems Design and Change", "1", "Murphy", "Brian");

    BISStudent diarmuid = new BISStudent("IS2216", "Introduction to Object Oriented Programming", "2", "Bowe", "Diarmuid");

    BISStudent brianMc = new BISStudent("IS2213", "Database Management Systems and Distributed Environments", "3", "McCarthy", "Brian");

    //Print out the values of the three BISModule objects

    System.out.println(" \t SAD \t ");
    System.out.println(" \t --- \t ");
    System.out.println("Course ID: " + brian.getCourseID());
    System.out.println("Description: " + brian.getDescription() + "\n");

    System.out.println(" \t Java \t ");
    System.out.println(" \t ---- \t ");
    System.out.println("Course ID: " + diarmuid.getCourseID());
    System.out.println("Description: " + diarmuid.getDescription() + "\n");

    System.out.println(" \t DBMS \t ");
    System.out.println(" \t ---- \t ");
    System.out.println("Course ID: " + brianMc.getCourseID());
    System.out.println("Description: " + brianMc.getDescription() + "\n");


    //Display the first and last names of the three students

    System.out.println("SAD Student: " + brian.getLastName() + ", "
    + brian.getFirstName());

    System.out.println("Java Student: " + diarmuid.getLastName()
    + ", " + diarmuid.getFirstName());

    System.out.println("DBMS Student: " + brianMc.getLastName()
    + ", " + brianMc.getFirstName());
    ************************************************** *******
    public class BISStudent extends BISModule
    {
    String studentID;
    String lastName;
    String firstName;

    public BISStudent(String iCourseID, String iDescription, String iStudentID, String iLastName, String iFirstName)
    {
    super(iCourseID, iDescription);

    studentID = iStudentID;
    lastName = iLastName;
    firstName = iFirstName;
    }

    public String getStudentID()
    {
    return studentID;
    }

    public String getLastName()
    {
    return lastName;
    }

    public String getFirstName()
    {
    return firstName;
    }

    public void setStudentID(String iStudentID)
    {
    studentID = iStudentID;
    }

    public void setLastName(String iLastName)
    {
    lastName = iLastName;
    }

    public void setFirstName(String iFirstName)
    {
    firstName = iFirstName;
    }
    }
    ************************************************** *******
    public class BISModule
    {
    String courseID;
    String description;

    public BISModule(String iCourseID, String iDescription)
    {
    courseID = iCourseID;
    description = iDescription;
    }

    public String getCourseID()
    {
    return courseID;
    }

    public String getDescription()
    {
    return description;
    }

    public void setCourseID(String iCourseID)
    {
    courseID = iCourseID;
    }

    public void setDescription(String iDescription)
    {
    description = iDescription;
    }
    }

  2. #2
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    Try reading up in your book or asking your professor to better explain inheritance if you don't get it. Good luck trying to find someone on here to do your homework for you though .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •