Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Assignment: Assessable Lab Tasks

Overview

This assessment task provides an opportunity to perform some independent design and associated programming tasks involving multiple classes. The purpose of the task is to review some of the learning about object oriented programming from Programming 1, extend this a little and provide an opportunity during lab classes to gain feedback regarding your ability and progression in the course.

Learning Outcomes Assessed

1: Discuss basic object oriented concepts
2: develop object-oriented programs involving several interacting classes

Objectives:

• Write a small multi-class program with appropriate methods
• Write classes involving simple association relationships to other classes
• Properly apply the principles of encapsulation and information hiding
• Make correct use of object reference variables
• Perform testing and debugging using the debug mode in Eclipse
• Code classes to ensure that objects will always have a valid state
• Understand the significance of the ‘static' modifier
• Be able to design test cases to test methods of a class to ensure objects of that class behave according to its intention
• Be able to arrange test cases into a test plan in order to thoroughly and adequately cover all key aspects of a class
• Write a test driver to execute the test plan and
• Be able to use Eclipse's debugging tools to set breakpoints, inspect variables, and step through code to observe the behaviour of code to detect errors

Requirements to demonstrate:

• Design interaction between classes so that objects of different classes can interact (i.e. send/receive messages)
• Ensure that classes have an appropriate toString() method
• Explain what object state means and how this can influence object behaviour
• Describe how to ensure that an object's state is always sensible
• Code classes to ensure that objects will always have a valid state
• Properly document classes, with method headers that are descriptive enough for other people to understand the code
• Be able to design test cases to test methods of a class to ensure it behaves according to its intention
• Be able to arrange test cases into a test plan in order to thoroughly and adequately cover all key aspects of a class
• Write a test driver to execute the test plan and
• Demonstrate use of Eclipse's debugging tools to set breakpoints, inspect variables, and step through code to observe the behaviour of code to detect errors.

Assessment Details

Exercise 1 - to be completed in pairs

Step 1.

Discuss the objectives for this week and together design a simple system that involves at least two objects interacting. One of these objects must represent a food item of some kind (e.g. a cupcake or hamburger). The other object should represent a stall that the food item is sold from. Your system must involve at least two associated objects that satisfy these rules:

• The food item object must have some kind of dynamic status (for example you might represent the current status of the food item in terms of price, ingredients, or freshness). It must be possible to change the status of the food item using appropriate methods;

• Your food item object must have a unique automatically generated ID that is created when you create each food item object;

• The two objects are associated so one class has a reference attribute to identify the other object (for example a stall contains an array of food items - each stored as particular food item objects).

An example to inspire you follows:

A farmer's market contains a variety of stalls. Each stall has a name, an owner and can sell a variety of food items according to its classification e.g. a hamburger stall might sell hamburgers, soft drink and chips, a cupcake stall might sell cupcakes and coffee. Every food item has detailed information stored about it such as the wholesale costs and retail costs. Food items can be hot or cold and come in small, medium or large.

Step 2.

Write a short description using words for your system that explains how the 2 objects interact with each other. Ensure you have described the interaction in terms of messages or actions between the objects. Show your tutor to verify your design before proceeding.

Discuss the methods required for each class design so that your objects are capable of the desired behaviour.

1. For each method, answer the following questions,

• What does this method do (e.g. does it produce output or change the object state)?
• When is this method valid (e.g. does the object have to be in a special state for this method to be performed)?
• Plan a process to validate that the method is working as desired (e.g. create some specific test cases)
• Write pseudo code to specify the logic and decision making required in this method

2. Draw a UML class diagram for each class (you may do this on paper or by using Enterprise Architect (available in the resources section on Moodle, see appendix))

3. If the previous step was completed using Enterprise Architect, you can generate code stubs for your two classes with set and get methods to be filled in, otherwise, you need to create the code yourself in a new Eclipse project

4. Take the code stubs generated in the previous step and create your own project in Eclipse.

5. Fill in code in the get/set methods

6. Create a toString() method for each class

7. Write the code for each method, based on pseudo code already written. Ensure you check that objects are in the correct valid state for each method.

8. Write a simple test driver class to test your classes are working

9. Using the debugger mode in Eclipse, check that the states are being updated appropriately on your objects (you will be asked to demonstrate this use as part of exercise 2 of this document. This demonstration will take place in the laboratory in week 4)

10. Demonstrate to your tutor that your code works

As you conceptualise your system, it may assist you to consider a similar system involving students at a TAFE college enrolling into a Course. The enrolment phases include 5 possible status options for a student: applied, enrolled, completed, graduated, cancelled. When a student applies to the TAFE program, they are given a unique student number. The first student (ever) who is entered into the system is given the number 293142, subsequently, each student who applies is given the next available student number. Student numbers are always even numbers. As part of the TAFE program, students may be enrolled into a number of courses. Each course instance is allocated a teacher and has a list of enrolled students.

Exercise 2 - Demonstration to be performed individually.

Using examples from the code you wrote.

• Explain the difference between public and private;
• Explain the principles of encapsulation and information hiding;
• Describe and relate the terms: public interface, information hiding;
• Explain the significance of the ‘static' modifier;
• Describe your chosen test cases;
• Explain the results of your testing.

Demonstrate that you can use the debugger to your tutor by showing

• use of Eclipse's debugging tools to set breakpoints, inspect variables, and step through code to observe the behaviour of code to detect errors.

Attachment:- Lab-Assessable-Exercises.rar

Java, Programming

  • Category:- Java
  • Reference No.:- M92764253

Have any Question?


Related Questions in Java

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Can someone kindly help me to consider whether java

Can someone kindly help me to consider whether Java provides the facility of operator overloading? If it does, may you kindly describe how overloading operators can be accomplished? If not, may you kindly describe why yo ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As