assignmentspecification_2

Upload: brian-french

Post on 14-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 AssignmentSpecification_2

    1/7

    Object Oriented Program Design 110

    Assignment Specification

    Final Assignment Submission: 12.00 midday, 3/6/2013

    This assignment contains three sections:1. The assignment specification.2. Appendix A: The assignment cover page template. Assignments submitted without

    the completed cover sheet will not be marked.3. Appendix B: A description of java code which allows you to get the current date and

    time from the system.4. Appendix C: A proposed time schedule for successful assignment completion.

    LogisticsThis is not an assignment which can be put aside until a few days before it is due. You arerequired to perform assignment based tasks on a weekly basis. Your final mark will be

    directly coupled to: Your ability to ensure that progress on the assignment is made every week and that

    the weekly reading tasks are successfully completed. Your ability to communicate and to read and comprehend text based material.

    Your ability to demonstrate an understanding of how to design, implement and test

    an object oriented software application. Your ability to pro-actively seek assistance when required.

    Marking Strategy.The Pseudo code algorithm and Java implementation will be marked. The marks for your

    reading interviews will then be converted to a weighting in the range 0.0 to 1.0. Thisweighting will then be applied to the mark calculated from marking your pseudo code andJava code. The result is your assignment mark. You will be interviewed on the first eightchapters of the pdf file text book in the practicals occurring in the weeks indicated in theschedule contained in the unit outline. Please keep checking this timetable so that you areaware of when the reading interviews will occur. If you miss your practical in a week whichhas reading interviews then contact me immediately for an alternative. Note immediatelymeans the second you realise you have missed your interview not three weeks later.

    Submission RequirementsThe assignment must be handed in in printed (not handwritten) form. Electronic copies of

    all assignment documents must be kept in your Curtin user account. The assignmentcover sheet should follow the template provided in appendix A and all the informationspecified must be supplied and be correct. You must also sign the declaration on the coversheet. Failure to conform to these requirements will result in your assignment not beaccepted and marked.

    Each assignment submission should be made in hard copy form and should contain: A completed cover page (as specified in appendix A).

    A complete set of pseudo code and Java for the algorithms and code

    implementation for the software. Note the Java code must be compliant with theDept of Computing Java coding standard (available from Blackboard) and must be

    fully documented. The Java code must be a valid implementation of your suppliedpseudo code.

  • 7/30/2019 AssignmentSpecification_2

    2/7

    Java APIJava comes with a fairly impressive library of classes which, for a developer, is incrediblyuseful. Unfortunately this makes an assignment in a unit such as OOPD110 very difficultbecause most tasks can be done via this library. For this reason you may not use any ofthe Java API classes other than:

    Those already used in the worksheets (e.g. System.out)

    Those mentioned in Appendix B.

    You are also not permitted to use arrays in your solution.

    You may also use the ConsoleInput class as you have been in your practicals. For thepurposes of this assignment you may assume that when inputting a filename that thename consists of a collection of alphanumeric characters, followed by a period, followed by1 or more alphanumeric characters. This means you can use the ConsoleInput.readWordmethod for this task.

    Software Description.

    A Caesar Cypher is one where each alphanumeric character in a body of text is shifted afixed number of places to the left or right. The shift is circular so that if 'A' is shifted two tothe left it becomes 'Y'. Similarly for lower case and digits (e.g. if '8' is shifted three to theright it becomes '1'. Characters which are not a letter or a digit are left untouched. Youneed to design in pseudo code and implement in Java an application which:

    Displays a menu allowing the user to choose from 1) encoding a file, 2) decoding a

    file and 3) quitting the program. The input should be an integer in the range 1 to 3. If encoding is chosen then the algorithm should prompt for an input file name and

    an output filename and then read each character from the input file, use the CaesarCypher technique to encode it and then write it to the output file. Only alphanumeric

    characters should be shifted. See the section below for how to calculate the shiftvalue. To encode the shift is a left shift. If decoding is chosen then the algorithm should prompt for an input file name and

    an output filename and then read each character from the input file, use the Caesarcypher process to decode it and then write it to the output file. Only alphanumericcharacters should be shifted. See the section below for how to calculate the shiftvalue. To decode the shift is a right shift.

    A time stamp should be printed on the first line of files containing encoded data. Thisshould be of the format below:

    hour,minute,day,month,year

    There should not be any blank spaces on this line and each value should consist of therequired number of digits. For example:

    9,54,3,6,2013

    represents a time stamp of 9.54am on June 3rd 2013.

    15,5,25,10,2013

    represents a time stamp of 3.05 pm on October 25th 2013.

    When decoding the file the time stamp should be read from the input file and displayed to

  • 7/30/2019 AssignmentSpecification_2

    3/7

    the user but output files containing decoded data should not contain a time stamp. Youmight find the Unix diff command rather useful because if the output of the command:

    diff fred barney

    is nothing then the two files contain exactly the same characters. Otherwise the output will

    be the lines in each file that are different.

    The shift value is calculated by counting the number of blank spaces in the text containedin the input file and taking the right hand two digits as the shift value (e.g. if there were 681blank spaces then the shift value is 81). The shift is a circular shift so when you reach theend of the range of characters (e.g. 'A' to 'Z') then you wrap around to the other end andkeep counting. For example if the shift value is 81 and the character is an uppercase letterthen your algorithm would wrap around three times and then move 3 places so if the uppercase letter was 'M' and it was a right shift then the new character would be 'P'.

    OOPD-110 does not teach file access in Java so a small Java library has been provided

    for your use (TextFile.java which can be downloaded from Blackboard). All file accessMUST be done via the Java code in this file. You are not permitted to make use of any ofthe standard Java API for file access.

    The TextFile.java file has been documented and all students should print out the file andgo through and understand the function of each method in the file BEFORE they attemptto make use of it in their assignment. To test your knowledge you should develop sometest programs which do things like copying the file out to the screen or copy from one fileto another (no cyphers involved).

    You must have the following classes in your design. You should have other classes as well

    but these ones must be present and must fulfill the specifications below:

    Class TextFile: used for file access and provided for you to use. Take a copy of this codefrom blackboard. There is no need to provide pseudo code for this class.

    Class DateClass: used for keeping track of a date. This is the example class provided onBlackboard. There is no need to provide pseudo code for this class.

    Class Time: used for keeping track of hours and minutes expressed in the 24 hour clock.You must design this class in pseudo code and implement it in Java.

    Class CypherFile: This class must inherit from the class TextFile. Its sub classfunctionality must provide a means of:

    Determining the shift value for the input file.

    Left shifting a character using the shift value.

    Right shifting a character using the shift value.

    You must design this class in pseudo code and implement it in Java.

    Class TimeStamp: used for keeping track of the current date and time. You must designthis class in pseudo code and implement it in Java. You must make good use of two otherclasses when designing this class.

    Object Orientation IssuesIn addition to the previously mentioned class, others will be required. Students should give

  • 7/30/2019 AssignmentSpecification_2

    4/7

    careful thought to the best arrangement of classes for the application. Marks will beallocated for your choice of classes as well as for the overall functionality of your algorithmand Java implementation.

  • 7/30/2019 AssignmentSpecification_2

    5/7

    Appendix A

    Object Orientated Program Design 110Assignment Cover Sheet

    Semester One2013

    Student Number:

    Family Name:

    Other Names:

    I declare that:1. I am aware that use of work done by others without declaring where the work came

    from IS plagiarism.2. This assignment is all my own work (other than the code supplied by the unit

    controller).3. Curtin University has a Student Misconduct Policy and, should I use the work of

    another in my assignment then I will be in breach of this policy.

    Student Name (Print):

    Student Signature:

    Date:

  • 7/30/2019 AssignmentSpecification_2

    6/7

    Appendix B

    Java Code for Getting the Current Date and Time

    Consider the Java code below. This code successfully retrieves the current date and time.You must use exactly the same API library calls in your assignment. The date and timeMUST be stored in appropriate objects (e.g. date in a dateClass object. Similarly for time.

    import java.util.Calendar;public class WhatTime{public static void main( String [] args)

    {int day, month, monthField, year, hours, minutes;Calendar cal;

    cal = Calendar.getInstance();

    day = cal.get(Calendar.DAY_OF_MONTH);monthField = cal.get(Calendar.MONTH);year = cal.get(Calendar.YEAR);

    month = calcMonth( monthField);

    hours = cal.get(Calendar.HOUR_OF_DAY);minutes = cal.get(Calendar.MINUTE);}

    public static int calcMonth( int monthField){int month = 0;

    switch( monthField){case Calendar.JANUARY: month = 1; break;case Calendar.FEBRUARY: month = 2; break;case Calendar.MARCH: month = 3; break;case Calendar.APRIL: month = 4; break;case Calendar.MAY: month = 5; break;case Calendar.JUNE: month = 6; break;case Calendar.JULY: month = 7; break;

    case Calendar.AUGUST: month = 8; break;case Calendar.SEPTEMBER: month = 9; break;case Calendar.OCTOBER: month = 10; break;case Calendar.NOVEMBER: month = 11; break;case Calendar.DECEMBER: month = 12; break;}

    return month;}

    }

  • 7/30/2019 AssignmentSpecification_2

    7/7

    Appendix C

    Development Schedule

    Often students make the mistake of waiting until everything required for an assignmenthas been covered before they commence work on their assignment. This is not possible inthe case of this assignment. Firstly the reading part of the assignment occurs throughoutthe semester.

    In terms of the programming task I suggest the following schedule: By week 3 have an understanding of what the assignment is asking you to do. You

    will not know how to do it but be familiar with the specification. By week four, test the code provided in Appendix B and make sure you can get it to

    work on the computer you intend to do your assignment on.

    By week5, design in pseudo code and implement in Java a program which inputs acharacter and a shift value and outputs the character shifted to the left and the rightby the input value.

    By week 6 modify the algorithm you wrote for week 5 so that any character can be

    input but it is only shifted if the character is alphanumeric. By week 7. Write an application that uses TextFile.java and copies the contents of

    one file, character by character to another file. Also design an algorithm that willdisplay a three option menu, input an option, do the option and repeat this processuntil the option is quit.

    By week 8 to 10. Start designing the required classes in pseudo code. Begin by

    getting your copy of dateClass to compile. Then start with the simple classes and

    work your way towards the sub class that is required. By week 12 you have most of the bits and pieces done to complete the assignment

    so now finish it and test it.