Reference no: EM13317731
Task 1 Designing and Documenting your system
Examine the sample code you have been provided with. This code is for a simple Car Hire management system. It contains a number of classes. Class Diagrams for Car and Person classes are provided here for illustration purposes ( Note that get and set methods are not shown in the class diagrams, in keeping with convention, although they do exist.)
Car class Person class
Car
|
String make
String model
String registrationNumber
String colour
int warrantyDist
|
String toString ( )
|
Person
|
String name
Car car
String city
|
String toString ( )
|
1. Create a document named: surnameStudentIDAssign1.doc . In your document, you must include the following section headings: System Overview, Class Diagram, Class Descriptions, Testing.
System Overview
In the System Overview section you are to write 100-200 words describing your system and a made up use for your system in an imaginary/real world scenario. You will need to review this after completing all tasks and ensure that your overview explains your entire system. State any assumptions you are making in your system.
Class Diagram
In this section, you are to provide a class diagram for every user authored class in your system.
Class Descriptions
In this section, you are to describe each class you have written. For each class describe the instance variables as well as methods provided in that class. For each method, describe parameters (if any) as well as any output produced. Give examples of the output if appropriate. Describe the functionality achieved by each method.
Testing
As you develop your classes and methods, you will write testing code to verify that your code is working correctly. In this section, you will describe your chosen test data and explain how that data helps you test your code. Make sure that you choose a variety of test cases to ensure you can be satisfied that your code is working. Include screen shots of your testing results in this section.
Task 2 Creating your base classes
Create a new project in Eclipse called Assignment 1.
Within this project create a package called task02.
1. Authortwo new classes within your newly created package. Choose two related real world objects (similar to the Person and Car objects in the sample code provided) that you are modelling where one object might own or use or provide a service to the other object. e.g. a Person might own a Pet, a library might own a Book, a Person might hire a Video, a Teacher might teach a Student, a Coach might train an Athlete, a Dentist might treat a Patientetc.Due to this relationship, one of your objects will have a reference to the other object (similar to the Person having a Car).
2. Descriptions of each class and Class diagramsmust be entered into your document created in task1. List any assumptions you make. Describe the relationship between the classes.
3. Explain the methods that you have authored - provide a description and type of any parameters and describe the purpose for each method.
4. Give an example of output that would be produced by your method/s.
5. Explain the constructors that you have provided. You must provide at least 2 constructors:
a. A default constructor which assigns each instance variable a default value. The String variables (e.g. name) should be initialised to "unknown", and object fields initialised to null.
b. A constructor with parameters which assign values to each instance variable. Note that the values to initialise the values and objects should be passed in using argumentswhen the constructor is called - the fields should not be instantiated in the constructor.
6. Author get and set methods for your classes for each instance variable.
7. Write a toString method that will return a String containing all the relevant data for each of your objects.
8. Create a new Test01 class. In this class, provide a main method containing code to test both constructors, at least one get and one set method and your toString method.Run your test and make sure your class is behaving correctly.
9. In your documentation, explain how you have tested your code and the results of your testing. Include screen shots demonstrating the output when you tested your code.
Task 3 New objects based on extending other objects
1. Create a new second package, called task03, within the project Assignment 1. In this class you will create two new classes that extend classes from the package task02. It is likely that you will be able to say your subclass ‘IS A' special type of your superclass. For example, A HireCar IS A Car, similar to HireCar which extends the class Car and A Customer ISA Person, Customer extends task01.Person in the sample code you were provided. Be creative and think of two(2) new classes that can extend yourexisting classes.
a. One of the new classes must be based on a reference extending an existing class from package task02 directly(similar to how Customer extends Person in the sample code).Do not repeat that package task02 class in the task03 package.
b. With the second new class, you may create a modified copy of your original class from package task02 in task03. Modify that copy of the original class so that it cannot be instantiated alone, but only the new class can be created.
Discuss your choice of classes and sub-classes with your tutor during a labclass prior to week 5.
2. Some further descriptions and class diagrams of classes in the sample code are provided in Appendix A. Refer to the sample code you were provided. Read these and understand them, then you need to create class diagrams for your own system and add descriptions of your new classes to your report document.
3. In your new classes, create at least 2 new methods that act on the new objects e.g. by performing a calculation based on the data in the object.Document these methods in your report.You may need to be creative with the instance variables you associate with your objects to think of a calculation you can provide. If you have any difficulty with ideas, discuss this with your tutor.
4. Test your classes to check they are working correctly. Document your testing process - describe your test data and the outcome of your testing. Include screen shots in your report document illustrating your testing process and the outcome of your testing.