You are on page 1of 6

48024 Applications Programming Assignment 1: Email

Topics: OO design, standard patterns, lists Objectives: This assignment supports subject objectives 1 - 3. Due date: Friday 12 April, 6:00 pm Value: 30%

1.

Individual work

You should write every line of code. You may discuss ideas, approaches, and problems, but you should write every line of code except for any base code provided on UTSOnline. Do not send your code to any student; it is an offence to provide a solution, or to have a copy of someone else's solution, before the due date. More information about Academic Misconduct can be found at http://www.gsu.uts.edu.au/rules/student/section-16.html

2.
2.1

Specification
System specification Build a simple email system that has single and group email. The user options are add a user enter the user name delete a user enter the user name add a group enter the group name, then the names of the users in the group use email this takes you to the use menu, described below list your email the email headers are shown, with indices read an email enter the index, system shows the email header and content send an email enter the to name, the header, and the content If a group name is entered, the email is sent to all users in the group A sample IO trace is shown in Appendix A, with a full trace in Assignments/1/io.txt.

2.2

Error cases If an input is invalid, tell the user and return. Check add a user: the user name is unique add a group: the group name is unique, and the members exist send email: a bad group or user name is found at send time bad message index: no such index bad menu choice: no such choice

2.3 Special requirements Use lists for all your data structures; do not use arrays. Each array loses 10 marks. Use only the class In to get input. Do not change it. Do not ask me if you can change it. Do not use a separate UserInterface class. Just use the class In as it exists to read all your input.
1 of 6

2.4

Time to complete Include one comment on the line above public class Root. The exact format is

// Time = n

where n is the number of hours you spent on this assignment. Use this exact format: Write // starting in column 1 Write a single space after the // The word Time starts with a capital T Write a single space after the word Time Write a single space after the = sign Write the number of hours you used (an integer) Write nothing after the integer This should be the only comment in your code. MoMa pulls this line out of your code before deleting all comments, so the format must match exactly.

3.

Expected work load

This assignment has been estimated at a load of 25 hours for the typical student who has completed all the tutorial and lab exercises. The hardest part of the model solution is described in Appendix B; the workload assumes you understand this code.

4.

Online support

FAQs (Frequently Asked Questions) and their answers are posted on UTSOnline in Assignments/1/faq. If you have a question, check the FAQ first; it may already be answered there. You should read the FAQ at least once before you hand in your solution, but to be safe check it every couple of days. Anything posted on the FAQ is considered to be part of the assignment specification. The FAQ will be frozen (no new entries) two days before the due date; no questions will be answered after it is frozen. If anything about the specification is unclear or inconsistent, contact me and I will try to make it clearer by replying to you directly and posting the common questions and answers to the FAQ. This is similar to the job experience, where you ask your client if you are unsure what has to be done, but then you write all the code to do the task. Email Robert.Rist@uts.edu.au to ask for any clarifications or corrections to the assignment. I cannot tell you how to design, write, or debug your code; that is your task. I cannot answer questions of the form "Is this right?"; I cannot "pre-mark" your design, or your code. There is no discussion board; the assignment tests your individual ability, so it is not appropriate to share problems and solutions. The tutorials and labs provided a forum for discussion and an opportunity for feedback.

5.

PLATE marking

Your solution is marked for correctness by PLATE, that compares the output of your system to the output of the model system. You can submit a solution to PLATE many times; I urge you to do this, so you receive credit for your work. The root class must be named Users and must include a static main method with the right parameter. The code in the main method should contain only a call to the constructor, as shown:
public class Users { public static void main(String[] args) { new Users(); }

2 of 6

6.
6.1

Design marking

MoMA marking Your system is marked for good design by the MoMa (Model Matcher) tool. MoMa compares your code to the model solution using a set of metrics that reflect good design. This was done to ensure a consistent marking scheme, in response to student complaints about inconsistent marking by hand. This automatic marking has no flexibility; MoMa counts the stated things and gives you a mark. The model solution was designed using the design rules and standard patterns taught in the subject. In many cases, the patterns and rules result in just one solution and there is no choice. In other cases, a solution that obeys the design rules and is a simple, elegant, reusable solution is fine. 6.2 Special MoMa requirements MoMa does not include a full Java compiler. It relies on the standard Java layout and spacing conventions to parse the code. If you do not follow the conventions, then MoMa may not be able to parse your code. I will fix any small errors, but I cannot re-write your code. If MoMa cannot parse your code, then your design mark will be zero. Things to avoid are anonymous classes static blocks If you have no idea what these are, there is no problem. 6.3. Manual marking Good names and simple, clear, reusable code that uses the standard patterns are marked by the subject co-ordinator.

7.

Spoofing

Your code is marked mainly by software, so you can get a good mark by fooling or spoofing the software. The penalty for spoofing is no marks for that task and a penalty of that task mark (correctness mark); if you spoof a task worth 20 marks, you get no marks for the spoof and lose 20 marks.

8.

Submission and return

There is no scheduled late submission period. An extension of up to one week may be given by the subject co-ordinator before the due date; you have to supply documentary evidence of your claim. PLATE shows you the mark for correctness when you submit your code. The marking sheet shows the correctness, design, and final marks; it can be picked up from the Learning and Design Centre on level 6 of Building 2 (2.06.39) at the start of week 9. An extension CANNOT be given after the due date. 8.1. Special consideration You may apply for special consideration (SC) either before or after the due date, at http://www.sau.uts.edu.au/assessment/consideration.html. You must provide evidence to support your claim, such as a doctor's certificate, a statutory declaration, or a letter from your employer. You can apply for SC before or after the due date.

9.

Marking scheme
The final mark measures how well you did of how much you did; the formula is sqrt(correct * design) where both components are marked out of 100

3 of 6

9.1

Correctness (100) 5 Menus 10 Add a user 15 List email 10 Send to a user

10 25 25

Delete a user Read email Send to a group

Penalties Spoof Arrays Extra IO classes 9.2 Good design (100) 5 Classes 20 Functions 10 Small methods 10 Good names

-2*n marks for a part worth n marks -10 marks per array -10 per extra IO class 5 10 20 20 Attributes Procedures Class encapsulation Simple code

Penalties Bad spacing Bad indenting Bad bracing Empty method Unused method

-1 per bad spacing, maximum 10 -1 per bad indent, maximum 10 -1 per bad brace pair, maximum 10 -1 per empty method, maximum 10 -1 per unused method, maximum 10 show and toString are not counted

9.3

Minimum essential requirements A perfect solution for half the problem or a good solution for about 2/3 of the problem, with no penalties.

4 of 6

Appendix A: Sample IO trace


All indents are in steps of two spaces. The x choice exits a menu. Space lines have been added to this document to show the cases. There are no space lines in the real system IO.
Choice (a/d/g/u/x): a Name: Homer User 1: Homer Choice (a/d/g/u/x): a Name: Marge User 2: Marge Choice (a/d/g/u/x): a Name: Lisa User 3: Lisa Choice (a/d/g/u/x): u Name: Homer Choice (l/r/s/d/x): s To: Lisa Header: homework Message: yuk Choice (l/r/s/d/x): x Choice (a/d/g/u/x): u Name: Marge Choice (l/r/s/d/x): s To: Lisa Header: Learning Message: Yes, do it Choice (l/r/s/d/x): x Choice (a/d/g/u/x): u Name: Lisa Choice (l/r/s/d/x): l Lisa has 2 messages 1: homework 2: Learning Choice (l/r/s/d/x): r Index: 1 homework: yuk Choice (l/r/s/d/x): d Index: 1 Choice (l/r/s/d/x): x Choice (a/d/g/u/x): g Group name: simps Member name (or x): Member name (or x): Choice (a/d/g/u/x): u Name: Homer Choice (l/r/s/d/x): To: simps Header: d' Message: oh Choice (l/r/s/d/x): Choice (a/d/g/u/x): x

Marge Maggie s

5 of 6

Appendix B: The hardest bit: send


About this code No claim is made that this is the correct version of the solution code; it is shown to make the explanation clear, not to provide the solution. You do not have to use this code. If you do use it, you are free to change it in any way. Please do not ask me questions about this code, because I cannot answer them. Once I start answering individual questions about specific code there is no clear stopping point. I provide this code to help you, but I cannot give you more detail than this. Context The class User contains the user menu to list, read, and send email:
class User { private void execute(char choice) { switch (choice) { case s: send();

Problem To send email, however, the class needs access to the list of users to lookup the user:
class User { users.send(message); class Users { private LinkedList<User> users; public void send(message) { user.send(message);

Solution We need a pointer to the Users object, so store it as an attribute in the User constructor.
class Users { users.add(new User(this)); class User { private Users users; public User(Users users) { this.users = users; users.send(message); }

6 of 6