|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
/ f3 \( p' Z1 T' R3 D; QShanghai - 20072 K) d; ~+ K4 X$ x `
Assignment 2
( X2 z/ r# ~* _, M: P2 EDeadline 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): B* _& O; C2 L; h7 X# R5 [
1. 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.
. {; h# E! W5 `# g. i. _9 r! }' G' ?6 kThe staff must be able to:7 }2 `# y7 g }: \! u" l q/ |
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
+ h* i" B2 C+ e& }3 a$ \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.
+ W8 g& k4 v4 x/ R The interface should provide a menu so that the staff can:
, p7 q% E% X4 b" z; ca) Enter the names of the two Java program files to be compared
/ ]' u5 |+ U. R9 N6 c/ y For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
9 N0 _8 [$ c7 m& b+ B+ N5 f- C** 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).& e# C1 x, H2 t5 ~) m% W
BSA104 Business Programming – 2007: Assignment 24 _) o5 t: E# V0 _8 [
Page 2 of 56 H* r6 @0 `; H) i6 w
b) Print out to the screen all the lines of code that are the same4 x" B% B* E: L# Y7 s7 E
 Include the name of the file and the line number of the code being printed for each of the two files! W2 x& R% E/ V% L% ?: X
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared0 V# A2 D% K! f1 A6 u/ i
 the name, username and department of the user
# ~4 ]4 u3 L. N% Q the statistics of the comparison
) e. G/ ?2 M4 e+ k" O0 s; o- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
% _4 s/ `# c. R5 ?4 h the recommendation for further checking
. F0 h r8 o) @: Z- 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
# K1 M. \3 Q* x* D the names of the two files compared
/ n- _; ~! Q( T& ^6 B9 Yd) Leave the program (exit): m* n! q( d9 G4 A' M( V1 m$ H7 N
The ProgramCompare class: (Total maximum 20 marks available). u9 \6 B# y9 T7 R7 W" T
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)/ P9 K# l; B% M: U$ _
a) provide an error message if the files are not found or there is a problem opening them
) A+ C, D( H4 u1 \; db) compare each line of code
; c1 p8 c1 E) rc) print out the lines that are the same
5 o9 {% ~$ y( E: s2 z5 H' S2 [d) count the number of lines compared / lines the same( X% S: z2 K) e9 \
The AuthorisedUsers class: (Total maximum 20 marks available)% z" D, r7 s: z' [# j% A
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)
) J0 u6 G4 N. e& N4. Provide methods to:# h$ Z. X$ c. c* t
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
3 t X- f0 s8 @9 h3 Bb) return the name of the authorised user( _7 B# @5 z# W B" O$ Z) u
c) return the name of the department of the authorised user
: ~) {8 l- G7 z9 \Individual Data (Maximum 20 marks available)0 [9 a0 X0 v" }8 ?4 {, y- g7 y" G
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.
# J+ x$ X; l8 T5 w$ e6 ], f: iDocumentation (Maximum 10 marks available)) w6 ?3 U# t% t! R$ `
6. 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.
& z6 ]( x6 l& B2 h& @+ aBSA104 Business Programming – 2007: Assignment 26 q5 e% ]# T9 A9 m& t5 m* c' Q
Page 3 of 5 |
|