|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
i$ F4 l2 _, l" ?+ nShanghai - 20076 m. r- ]9 ~: b1 d$ o* K
Assignment 2
* C% A" M6 z$ B4 u; {Deadline for Submission: 10:00 pm (Shanghai time), Tuesday 15th May 2007 Assessment Weighting: 20% of the total assessment for BSA104 Assignment Type: Individual Scenario: The teaching staff at a nearby university are concerned that some of their students are submitting other students‟ work. They need a simple Java program that will compare the text of two other Java programs, line by line, for equality, and then print out the results, and a recommendation. Requirements: Consider the three Java Classes: ProgramCompareMenu.java, ProgramCompare.java and AuthorisedUsers.java, available from the Assignment 2 page on Vista. You are required to perform the following tasks: The ProgramCompareMenu class: (Total maximum 20 marks available)
: C% j6 z( w9 {' P1. Provide a basic text-based menu interface to the ProgramCompare class so that it can be used by two staff members to determine if the two supplied Java programs are the same or similar./ @+ N0 E& @( X% M8 h9 a4 T+ I
The staff must be able to:
* W1 F2 ~& Z* \% ~; W& O Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.7 X' J! L3 m* w" P% @& k( m
1. The user should not be able to use the „system‟ until they have provided the correct user name and PIN combination. You should give them a second or third chance to get it right before shutting the „system‟ down.# S# T. Y* M) p/ q
 The interface should provide a menu so that the staff can:
, o* K; f- C, ?% d9 z3 ba) Enter the names of the two Java program files to be compared
. R3 \- `: p/ T* j' L( m O, Y5 z; s For this assignment, it will be assumed that the two Java program files are in the same folder as your program.- |2 h) s+ W. a D# i
** You must use the two user names and PINs provided in your individual data available from the Assignment 2 page on Vista (see requirement 5 below). The user names and PINs should be included in your code, and the output to the screen should prompt the user with the user names and passwords (for marking purposes).
7 |3 P( X: m6 f/ {6 n7 ?BSA104 Business Programming – 2007: Assignment 2. x: C; J' C: m( Q1 k- Z
Page 2 of 5! f& F F& l7 F( X0 E/ `6 ?
b) Print out to the screen all the lines of code that are the same
- l' S" ^* @; f Include the name of the file and the line number of the code being printed for each of the two files
2 t2 V# W ^* ^" x( ic) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared. s ^# ]# \6 g9 d; X0 A4 T4 J& v
 the name, username and department of the user- W6 Z( D4 v. r; a T4 H* g
 the statistics of the comparison) x- c/ j) y' u; J# ]. G
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
4 Z i8 w0 a0 ^3 W9 F" Z. B the recommendation for further checking
+ d3 N8 f, F+ M: y& ?. X) i- For example: if more than 5 (five) lines of code are the same in each Java program file, then print a recommendation to the screen that the staff member check the files more closely; }3 X$ ]" K) @, ~
 the names of the two files compared6 p* _0 Z! Z7 b% T( t/ _
d) Leave the program (exit)& K8 w/ G* M1 A; g* Y7 v! k$ {
The ProgramCompare class: (Total maximum 20 marks available): C2 K4 n# \9 x, c/ k* }
2. Provide a method/s to read in each line of code from the two files identified by the user: (assumed that the two Java program files are in the same folder as your program)* @* i: S1 r( J0 `) G2 }. |
a) provide an error message if the files are not found or there is a problem opening them
! ?- m% C6 J3 c, ab) compare each line of code
7 f; V+ q, B) Gc) print out the lines that are the same1 y# a6 v# e) o0 D: ?
d) count the number of lines compared / lines the same* [2 N1 N% V2 \6 r7 ?
The AuthorisedUsers class: (Total maximum 20 marks available)1 D/ K+ f( U4 S
3. Provide an object that contains the name, username, PIN, and Department of the authorised users of the program (user names and PINs as provided in your individual data - see requirement 5 below)
! [4 }# z+ K1 ~. w$ J, D4. Provide methods to:
) v' E) y& T: y9 _- f% ha) compare the stored username and PIN with the one entered by the user - return a value that indicates whether they match or do not match5 U- e6 R/ ^# Q! S, N- r
b) return the name of the authorised user
2 S4 p. O+ D. Q( vc) return the name of the department of the authorised user
$ S( v+ s5 p* g) C0 jIndividual Data (Maximum 20 marks available)5 k$ X. H6 M( X8 V/ p) t8 d) b
5. You will be given two staff member names, usernames, PINs, and department name, plus a set of two Java program files to compare using your program. You will need to log onto the BSA104 Assignment 2 page on Vista to generate your individual data and instructions for this requirement. You will need to use your University of Tasmania (UTas) student number. @# C- n% B8 E2 D
Documentation (Maximum 10 marks available)
- v! |1 d8 u8 J0 _8 a" h% K6. Your program files should be fully documented, at least to the same standard as demonstrated in the textbook. This includes in-code comments, descriptions, and where appropriate, explanations for each new constructor, method and variable.
5 }# G3 @% b8 V- cBSA104 Business Programming – 2007: Assignment 2
( ^# D0 @ g T+ }: ~7 Q1 E' ~Page 3 of 5 |
|