Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CSSE2002/7023 — Semester 1, 2022

Assignment 1

Abstract

The goal of this assignment is to implement and test a set of classes and interfaces1. Language requirements: Java version 17, JUnit 4.

Preamble

All work on this assignment is to be your own individual work.  As detailed in Lecture 1, code supplied by course staff (from this semester) is acceptable, but there are no other exceptions. You are expected to be familiar with What not to do” from Lecture 1 and https://www.itee.uq. edu.au/itee-student-misconduct-including-plagiarism.  If you have questions about what is acceptable, please ask course staff.

Please carefully read the Appendix A document.  It outlines critical mistakes which you should circumvent in order to avoid losing marks.  This is being heavily emphasised here because these are critical mistakes which must be avoided.  If at any point you are even slightly unsure, please check as soon as possible with course staff!

All times are given in Australian Eastern Standard  Time. It is your responsibility to ensure that you adhere to this time-zone for all assignment related matters. Please bear this in mind, especially if you are enrolled in the External offering and may be located in a different time-zone.

Introduction

In this assignment, you will take the roll of an up and coming programming contractor. Your task will be to build a simple application. The script will take the form of a fictional story, to assist in your understanding of the task. This application is detailed in a specification given to you by the story’s protagonist. For this scenario, you will need to build up a system of classes and interfaces that meet the requirements that you have been given.  For this assignment you will be focusing on accessor methods (getter’s and setter’s) as well building an understanding of Lists and basic programming logic.

Story

Hello my dear programmer friend,

I have come to understand that you might be in a position to help me. You see, I feel as if I am in a bit of a rut and have decided that I need to make a life altering change. I am going to resign my position as the head of the Soup canning factory and pursue my dreams, taking on the role of a celebrity insect therapist, in a distant country.

Unfortunately, this means that I will have to move house, which is something I have very little experience in doing.

As such, I was hoping that I could enlist your skills to help me. I would like you to build a software application model to help me organise the packing of my life belongings, and to do so as efficiently as humanly possible.

Should you accept, there are a few things that I need you to model:

• To begin with I need something to store all of my items in. I have 3 different kinds of storage containers that I intend to use, and they come in various different sizes.

A moving truck that I will take all of my items in.

A cardboard box. This multi-purpose storage container be packed with many different items (including other boxes! How cool).

A duffle bag. I have a few of these that I will use to pack all of my personal items.

• I have some furniture that I would like to take to the next house with me too.  This would go into the moving truck last as they are quite heavy.

• As mentioned before, I have some personal items that I would like to take with me.  This includes items like clothes and laptops.  I’ve also got some items that I will be storing for some friends so I need to know who owns what.

Because I am not the best at packing, (and why I am asking you to create this application) some- times I may make mistakes and pack things in the wrong order.  The application will need to be aware of this. Would you be able to implement a system where if I pack too much into a container

or put something where it’s not supposed to be, that the application will let me know? Awesome, thanks so much!

- Protagonist

Supplied Material

This task sheet.

• Code specification document (Javadoc).2

• Gradescope, a website where you will submit your assignment.3

• A starting template for your assignment code, available for download on Blackboard.  The files in this template provide a minimal framework for you to work from, and build upon. These files have been provided so that you can avoid (some of) the critical mistakes described in Appendix A.

Each of these files:

is in the correct directory (do not change this!)

has the correct package declaration at the top of the file (do not change this!)

has the correct public class or public interface declaration. Note that you may still need to make classes abstract, extend classes, implement interfaces etc., as detailed in the Javadoc specification.

As the first step in the assignment (after reading through the specifications) you should download the template code from Blackboard. Once you have created a new project from the files you have downloaded, you should start implementing the specification.

Javadoc

Code specifications are an important tool for developing code in collaboration with other peo- ple. Although assignments in this course are individual, they still aim to prepare you for writing code to a strict specification by providing a specification document (in Java, this is called Javadoc).

You will need to implement the specification precisely as it is described in the specification docu- ment.

The Javadoc can be viewed in either of the two following ways:

1. Open https://csse2002.uqcloud.net/assignment/1/in your web browser. Note that this will only be the most recent version of the Javadoc.

2. Navigate to the relevant assignment folder under Assessment on Blackboard and you will be able to download the Javadoc .zip file containing HTML documentation. Unzip the bundle somewhere, and open doc/index.html with your web browser.

Tasks

1. Fully implement each of the classes and interfaces described in the Javadoc.

2. Write JUnit 4 tests for all the methods in the following classes:

• Book (in a class called BookTest)

• MovingTruck (in a class called MovingTruckTest)

Marking

The 100 marks available for the assignment will be divided as follows:

Symbol

Marks

Marked

Description

FT

45

Electronically

Functionality according to the specification

CF

10

Electronically

Conformance to the specification

SL

10

Electronically

Code style: Structure and layout

CR

15

By course staff

Code style: Design review

JU

20

Electronically

Whether JUnit tests identify and distinguish be- tween correct and incorrect implementations

The overall assignment mark will be A1   = FT + CF + SL + CR + JU with the following adjustments:

1. If FT is 0, then the manual code style review will not be marked. CR will be automatically 0.

2. If SL is 0, then the manual code style review will not be marked. CR will be automatically 0.

3. If SL + CR > FT, then SL + CR will be capped at a maximum of FT.

• For example: FT = 22,CF = 8,SL = 7,CR = 12,J = 13 ⇒ A1  = 16 + 8 + (7 + 12) + 13.

⇒ A1  = 16 + 8 + (19) + 13. Limitation will now be applied.

⇒ A1  = 16 + 8 + (16) + 13.

The reasoning here is to place emphasis on good quality functional code.

Well styled code that does not implement the required functionality is of no value in a project, consequently marks will not be given to well styled code that is not functional.

Functionality Marking

The number of functionality marks given will be

Unit Tests passed

FT = Total number of Unit Tests · 45

Conformance

Conformance is marked starting with a mark of 10.

Every single occurrence of a conformance violation in your solution then results in a 1 mark de- duction, down to a minimum of 0.  Note that multiple conformance violations of the same type will each result in a 1 mark deduction.

Conformance violations include (but are not limited to):

• Placing files in incorrect directories.

• Incorrect package declarations at the top of files.

• Using modifiers on classes, methods and member variables that are different to those specified in the Javadoc.   Modifiers include private, protected, public,  abstract,  final,  and static. For example, declaring a method as public when it should be private.

• Adding extra public methods, constructors, member variables or classes that are not de- scribed in the Javadoc.

• Incorrect parameters and exceptions declared as thrown for constructors.

• Incorrect parameters, return type and exceptions declared as thrown for methods.

• Incorrect types of public fields.

Code Style

Code Structure and Layout

The Code Structure and Layout category is marked starting with a mark of 10.

Every single occurrence of a style violation in your solution, as detected by CheckStyle using the course-provided configuration4, results in a 0.5 mark deduction, down to a minimum of 0.  Note that multiple style violations of the same type will each result in a 0.5 mark deduction.

Note:  There is a plugin available for IntelliJ which will highlight style violations in your code. Instructions for installing this plugin are available in the Java Programming Style Guide on Black- board (Learning Resources → Guides). If you correctly use the plugin and follow the style require- ments, it should be relatively straightforward to get high marks for this section. IntelliJ will also give you hints in the correct direction. Ensure you know the difference between a checkstyle and IntelliJ hint.

Code Review

Your assignment will be style marked with respect to the course style guide, located under Learn- ing Resources → Guides. The marks are broadly divided as follows:

Metric

Marks Allocated

Commenting

5

Naming

4

Code Design

3

Programming Practices

3

Note that style marking does involve some aesthetic judgement  (and the marker’s aesthetic judge- ment is final) .

Note that the plugin available for IntelliJ mentioned in the Code Structure and Layout section cannot tell you whether your code violates style guidelines for this section. You will need to man- ually check your code against the style guide.

The Code Review is marked in terms of generality rather than a deduction for each mistake.