|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
" p5 ?9 s' a @" lShanghai - 2007# J$ q' q3 S. Q- y& |5 ^* q
Assignment 2
( Y- y1 ? J3 ^- @& N9 pDeadline 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)
+ Y* w( |+ q3 i8 n1. 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.5 n% w) V2 C3 G( K# B8 @9 I
The staff must be able to:
% D2 n# s' M6 \+ C, G; V. ^ Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
# O' E! q+ W+ G/ a5 h' H1. 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.; q9 k2 V" F, ~8 J. |7 X
 The interface should provide a menu so that the staff can:
# M) O/ D! [! La) Enter the names of the two Java program files to be compared
# N7 n, O. i1 R For this assignment, it will be assumed that the two Java program files are in the same folder as your program.' v) K* G$ }$ f
** 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).6 J& n. D7 c& V, F/ @5 ~: Y
BSA104 Business Programming – 2007: Assignment 2 o: ]: H ~% Y; U: V) {, L8 q
Page 2 of 5
; ^. q( E6 n# ^. z% F! Pb) Print out to the screen all the lines of code that are the same* N8 [- F7 M3 F7 |$ W0 j
 Include the name of the file and the line number of the code being printed for each of the two files
( g4 }( Y: O5 N. I% \8 pc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared% \, v: Y; @$ g2 y
 the name, username and department of the user
' c+ J& M! O+ M. f$ c the statistics of the comparison
1 s+ O3 }5 k' s0 Z R7 _- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different" Y9 H2 ~9 U; ^$ ]
 the recommendation for further checking) z& @% J3 B$ N* e, K
- 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 closely6 r% g' {: X+ r, q; P
 the names of the two files compared0 Z6 y3 B9 X" t. A ^6 s: G3 g, d
d) Leave the program (exit)& p6 e5 K2 I! N+ i8 K2 `( c
The ProgramCompare class: (Total maximum 20 marks available)
! }* q: ^# ] [5 `' J2. 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)
7 Y4 g4 r I6 }. u, g2 R5 k+ l+ Qa) provide an error message if the files are not found or there is a problem opening them$ ~: e5 a. `4 u, n) J8 F) }
b) compare each line of code
& W% t, X R: ^$ O) r! X9 jc) print out the lines that are the same9 ~# u& F! k8 y' B
d) count the number of lines compared / lines the same
" ~9 V. {$ Q- P YThe AuthorisedUsers class: (Total maximum 20 marks available)
- [: E3 V* o9 R3 V; t3. 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)9 ], w T3 A2 m* v
4. Provide methods to:. Y( U5 [: B: O2 w% z
a) compare the stored username and PIN with the one entered by the user - return a value that indicates whether they match or do not match, N) e: A# ~- E+ n' H0 Y$ e
b) return the name of the authorised user4 k; z* I s; e5 ~
c) return the name of the department of the authorised user& E4 m6 g$ E; C) O& Y0 f0 L
Individual Data (Maximum 20 marks available)6 B/ u1 `0 K" z3 G7 s' n. U
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.: l. N& x$ X; \% m
Documentation (Maximum 10 marks available)
- S H6 f4 ]" `! u7 `* x9 Z6. 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.
3 m/ s' Y* M* a" A5 }- }& hBSA104 Business Programming – 2007: Assignment 2; Z" \9 x$ @, E4 z
Page 3 of 5 |
|