|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
/ A$ |! O- U" y6 M5 \* I3 z+ KShanghai - 2007
% f% Z1 m* J/ z9 C; r7 SAssignment 2) C1 {7 k; D; G- {5 Z( w' ^
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)& }! V+ O. a1 g& G9 H) z
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.
: }! a: E' m% _8 T$ C- }The staff must be able to:0 }( V8 x0 j3 p
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
4 [; M5 w: S6 i4 a* 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./ X) q1 {) T% o9 h5 P
 The interface should provide a menu so that the staff can:
4 @, I$ g a4 {a) Enter the names of the two Java program files to be compared. D' _# o: M1 b8 J
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.( M/ l" w! i) I; _( ]' t1 B
** 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).
1 R! p' U+ y# u/ ABSA104 Business Programming – 2007: Assignment 20 O7 o+ h9 {' E& T2 K6 f" {
Page 2 of 55 h7 d# d4 a: f, B
b) Print out to the screen all the lines of code that are the same
, o6 r! Q% U$ W7 d0 C Include the name of the file and the line number of the code being printed for each of the two files0 P) k% U m* u& M Q- D( E
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
* t' x5 ?9 i J# a" m( D0 b X: \6 [ the name, username and department of the user$ g: E2 C- C5 s% d
 the statistics of the comparison
7 x( A: p1 v2 @, O6 L- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
6 h4 ~9 g- ? x7 N) h ^; M the recommendation for further checking; D3 }: b5 L) Z: c# 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 closely( _( T- N7 u' c$ }
 the names of the two files compared7 ] S3 [. f$ Y4 G
d) Leave the program (exit)2 H. s" Q0 R2 x0 v" ^. l+ ^3 X5 h
The ProgramCompare class: (Total maximum 20 marks available) Z' n/ E. U" f g" M
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)
8 L/ V" m9 l8 R2 {! R9 y0 W" z; L& ?$ U! Na) provide an error message if the files are not found or there is a problem opening them
: C: I8 f8 v* e8 }) O! g1 h$ g! nb) compare each line of code% l3 H5 d( P8 b! U$ H; Y
c) print out the lines that are the same* w7 r: |* T2 M$ y7 Z3 [) y: |+ I
d) count the number of lines compared / lines the same
( u. A5 J w% Q% s8 _; tThe AuthorisedUsers class: (Total maximum 20 marks available)
6 p: T5 u5 ^2 Q& }- P1 n0 t7 Z7 }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)6 C! ~& x# y" |
4. Provide methods to:
/ o, H7 Q( m) Y% Pa) 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
" g5 ]( `* r( _! G; Ub) return the name of the authorised user
2 U) @& ^: k& ^- l0 ~c) return the name of the department of the authorised user
; Z/ u! J9 ?; z/ VIndividual Data (Maximum 20 marks available)
) ^& m* Y2 h* ]9 q, z: d5. 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.! S# {9 i* n* b/ A
Documentation (Maximum 10 marks available)
9 R1 d% S/ r m/ L' 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.: H: |6 z/ t4 w3 V! |" m
BSA104 Business Programming – 2007: Assignment 2
% F: N5 g. l+ l' m- u RPage 3 of 5 |
|