|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
, a# c3 s# k- R0 |, a) s+ aShanghai - 20072 r* g! o1 U' t) W" h& r' b
Assignment 27 Y( V# t' u3 @3 ?8 S3 u( T6 F
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)! A9 I! U; j% I x a# Q& ^ `4 y: \2 ]% X
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.2 q$ r7 {: Y0 `2 Y; t$ |& F
The staff must be able to:* A6 i1 ?6 c- b/ C V. g# X
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
+ I2 i3 d. i! X2 ]- z/ E1. 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.0 c$ i5 s1 x3 I# Y( z9 _
 The interface should provide a menu so that the staff can:
3 R' s5 X4 R4 D% y6 Da) Enter the names of the two Java program files to be compared
* l- q& Q+ T! g/ d1 A# E1 ] For this assignment, it will be assumed that the two Java program files are in the same folder as your program., \& u: E* D$ y
** 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).
- j! W; }# D6 ^ x9 v5 tBSA104 Business Programming – 2007: Assignment 2
0 b t/ @# R/ u; hPage 2 of 5* K3 { ^9 D+ D! ~) z* O
b) Print out to the screen all the lines of code that are the same% A- }5 V+ _2 g. Z
 Include the name of the file and the line number of the code being printed for each of the two files
+ E+ D5 d/ R; J3 S5 r t9 m, ?* uc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared% Q7 y' }5 y# l+ z, z, j
 the name, username and department of the user
0 `; \ \9 ^/ B- z8 O the statistics of the comparison
3 N. ^0 i8 H1 @- J% A6 j- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
- O6 R2 ]# v! J3 v the recommendation for further checking
. B1 g2 [ v/ ]' l: w4 V; M/ W: z8 P- 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
. G Z* v3 D1 m( f: y the names of the two files compared
/ l2 f" x4 [3 H) M7 t, Ed) Leave the program (exit)7 V0 m" \+ S1 b
The ProgramCompare class: (Total maximum 20 marks available)1 Y e. e+ r0 S) d* P$ d7 \
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)* x1 z% m3 N6 p& \* u/ q1 P
a) provide an error message if the files are not found or there is a problem opening them! P' V* z G9 n* L5 y8 {( B X
b) compare each line of code
7 J3 S U1 V- pc) print out the lines that are the same& i4 M, |& e7 Z$ U- y8 q
d) count the number of lines compared / lines the same# ~7 O4 n! P7 P* P8 p) v
The AuthorisedUsers class: (Total maximum 20 marks available)7 L! D9 k" k- b2 P
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)
. ~, x, K3 |/ f4. Provide methods to:) R5 H) |% c8 F, F
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( ?4 |8 f* O0 M e
b) return the name of the authorised user6 M! Q, j6 ]0 ?2 W, a7 e
c) return the name of the department of the authorised user: M2 w1 |/ F _$ m+ D k
Individual Data (Maximum 20 marks available). k" h, C/ r8 e5 B4 ]( [7 P, C9 x
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. j8 V8 @, r. D. b; C" D% w
Documentation (Maximum 10 marks available) A+ a: u8 a: K9 o" Q: @! \
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.' {9 J6 o! V, B4 w( R, l7 \' y
BSA104 Business Programming – 2007: Assignment 2
& t% d; \. k) RPage 3 of 5 |
|