PROJECT OVERVIEWObject-oriented programming takes the view that what we really care about are the objects than the logic. Examples of objects range from human beings (described by name, address, and so forth) to buildings and floors (whose properties can be described and managed) down to the little items in your life (such as pencil and eye-glass).
The first step in Object Oriented Programming is to identify all the objects you want to manipulate and how they relate to each other, an exercise often known as data modeling. Once you've identified an object, you generalize it as a class of objects and define the kind of data it contains and any logic sequences that can manipulate it. Each distinct logic sequence is known as a method. A real instance of a class is called an "object" or, an "instance of a class".
Based on this situation you are required to design a class which represents an object in the real world. The class must fulfill all the criteria listed below:1. At least two instance variables that specify the attributes of the object
2. Two constructors that initialize instance variables of class.
3. Provide list of set & get methods for all the attributes.
4. Provide at least three overloaded method 
5. Provide at least two subclasses which represent sub categories of the object. 
6. You need to override minimum one method in each subclass.
7. You should create at least 2 objects of each class and call all the methods available for that object.
8. There will be additional 2 s for implementing interface by any of classes (interface should contains at least 3 methods)
9. Write your classes in separate files.
10. You should draw a class diagram for this assignment. (In a class diagram we can show the member variables, and methods of a class. We can also show whether one class inherits from another). Figure 1 shows an example of class diagram.
11. Don’t forget to include screenshot to your report
12. Any project which is found to be the same as another will be penalized. If someone cheats by using your work, you will be penalized.Figure 1
OBJECTIVE• The objective of this Individual Assignment is for students to showcase their skill in Object Oriented Programming features.DEADLINE• Before the end of Week 7
• Submit during the Lab OR Lecture ONLY.SUBMISSION INFORMATION• Submit hardcopy personally to the unit controller of Java Programming II.
• Hardcopy must have the Limkokwing University of Creative Technology cover page with your names, ID, course name, semester, coursework title and lecturer name correctly printed, attached in front of the source codes and stapled together or bind together.
• Print out the source code by using COURIER NEW font style and size of 9 by using Microsoft Word. Include PAGE NUMBER on the bottom right.
• Student who submits this piece of Assignment 1 later than the deadline date stated above will have his/her s deducted accordingly as stated in the course outline.WORK ALLOCATION•  This project should be carried out individually only.ASSIGNMENT SECURITY• Backup copy: You are required to keep a backup copy of everything related to this coursework in case you need to refer to it in the future.
RULES AND REGULATIONS• You are to complete this assignment individually.
• You are NOT allowed to work with any other students, individual or do your work based on another program that is available from the Internet, or any other source.
• If there is too much collaboration from your common discussion by looking at the solutions, in such instances of academic dishonesty may result in you getting zero s for this piece of assignment.
• If someone cheats by using your work, you will be penalized.

解决方案 »

  1.   

    12. Any project which is found to be the same as another will be penalized. If someone cheats by using your work, you will be penalized.............................
      

  2.   

    第一个java文件,用于测试的
    /**
     * This is the main class for testing! I create two objects of each class. these
     * objects call all the methods available for that object.
     * 
     */
    public class MainTest
    { public static void main(String[] args)
    {
    ObjectTest obj1 = new ObjectTest("Jack", 22);
    ObjectTest obj2 = new ObjectTest("Jones", 21);
    ObjectTest subObj1 = new SubObjTest1();
    ObjectTest subObj2 = new SubObjTest1();
    ObjectTest subObj3 = new SubObjTest2();
    ObjectTest subObj4 = new SubObjTest2(); obj1.print();
    obj1.print(22);
    obj1.print("JACK&JONES");
    obj1.SayBye();
    obj1.sayHi();
    obj1.dOIt(); subObj1.print();
    subObj1.print(22);
    subObj1.print("JACK");
    subObj1.SayBye();
    subObj1.sayHi();
    subObj1.dOIt(); subObj3.print();
    subObj3.print(21);
    subObj3.print("JONES");
    subObj3.SayBye();
    subObj3.sayHi();
    subObj3.dOIt(); }}第二个java文件,父类
    /*
     * Creat a class which has two constructors and
     * two instance variables, as well as some setter and getter
     * methods. It also offers three overloaded methods.
     * It absolutely implements all three methods
     * of an interface named InterfaceTest
     */
    public class ObjectTest implements InterfaceTest
    {
    String name;
    int age; public ObjectTest()
    { } public ObjectTest(String name, int age) {
    this.name = name; this.age = age;
    } public String getName()
    {
    return name;
    } public void setName(String name)
    {
    this.name = name;
    } public int getAge()
    {
    return age;
    } public void setAge(int age)
    {
    this.age = age;
    } public void print()
    {
    System.out.println("Hello JAVA");
    } public void print(String name)
    {
    System.out.println("My name is " + name);
    } public void print(int age)
    {
    System.out.println("I am " + age + " years old");
    } @Override
    public void sayHi()
    {
    System.out.println("Hello,ObjectTest has implemented the interface"); } @Override
    public void SayBye()
    {
    System.out.println("bye! I am father"); } @Override
    public void dOIt()
    {
    System.out.println("Father does it");
    }}
      

  3.   

    以下是两个子类,和一个接口
    /**
     * This is the first sub class of class ObjectTest.
     * it overrides the method "print" that implemented 
     * by ObjectTest. it implements three methods which 
     * are stated in the interface as well.
     *
     */
    public class SubObjTest1 extends ObjectTest 
    {
    public void print()
    {
    System.out.println("Hello. I am the first subclass of ObjectTest ");
    }
    @Override
    public void sayHi()
    {
    System.out.println("Hello,sub1 has implemented the interface");

    }
    @Override
    public void SayBye()
    {
    System.out.println("bye! I am child no.1");

    }
    @Override
    public void dOIt()
    {
    System.out.println("child no.1 does it");
    }
    }/**
     * This is the second sub class of class ObjectTest.
     * 
     */
    public class SubObjTest2 extends ObjectTest
    {
    public void print()
    {
    System.out.println("Hello. I am the second subclass of ObjectTest");
    } @Override
    public void sayHi()
    {
    System.out.println("Hello,sub2 has implemented the interface"); } @Override
    public void SayBye()
    {
    System.out.println("bye! I am child no.2"); } @Override
    public void dOIt()
    {
    System.out.println("child no.2 does it");
    }
    }
    public interface InterfaceTest
    {
    public abstract void sayHi();
    public abstract void SayBye();
    public abstract void dOIt();
    }
      

  4.   

    类图就不给你画了,Eclipse可以自动生成,实在不行自己用word一刻钟就画完。
      

  5.   

    楼主,这题50%是靠你的英文水平,50%是考你的Java水平,挺简单的,你还是自己动手练练吧,顺便还能提高你的英文阅读能力,搞软件必须要求有很强的英文阅读能力,如果你想往高层次发展的话。
      

  6.   

    1. At least two instance variables that specify the attributes of the object
    至少有2个指定对象属性的实例变量
    2. Two constructors that initialize instance variables of class.
    写2个初始化对象的构造函数象考试题,不象面试题,简单。
      

  7.   

    大哥 看你貌似挺强的 能不能 教教我 留个E mail什么的给我吧
      

  8.   


    楼主慢慢来,刚看了一下,很基础的东西,编程思想很重要的喔。
    • If someone cheats by using your work, you will be penalized.
    看到最后一句,蛋疼的喔。
    如果你要别人帮你完成作业的话,你会受到处罚喔。
    不是楼主你做的,老师应该很容易就检查出来滴。
    楼主給点力吧。