|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
0 h d* V% L7 VShanghai - 2007
# p+ X4 _' Z& `1 @1 S+ p+ @Assignment 2
# e6 m6 E$ Q8 a( h0 b6 kDeadline 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)- H& M' E& N' ?' g$ @, ^- u
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.
* l- q: {( o% U0 j1 `; c FThe staff must be able to:+ l3 N' c2 S3 [! B5 H: x) r8 k
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.6 t2 q5 x, {2 k. D# D
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.+ ?8 j" P: r- m8 A* g
 The interface should provide a menu so that the staff can:
9 N8 P; n" h7 u. |+ S- ?* S) La) Enter the names of the two Java program files to be compared, I9 M) D3 E+ W
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
1 V$ A0 y R- ]4 U; w8 A9 y% q9 \** 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).
4 Q+ R6 ^$ t0 x. p; ABSA104 Business Programming – 2007: Assignment 2
2 f7 ~8 }8 V+ H% [/ fPage 2 of 5
2 _6 {: e& F) k$ |b) Print out to the screen all the lines of code that are the same v, [5 i! a" z* ?
 Include the name of the file and the line number of the code being printed for each of the two files
, Z, G9 y9 n/ M8 `6 l9 s6 O; yc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared1 C/ j a# n* P) j8 a7 P
 the name, username and department of the user) N4 ~! P! o6 X) d# u( s
 the statistics of the comparison
. l& @2 \$ f$ Q7 ~; y% q- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different/ d, p) Q' h0 e @! m9 H& ]
 the recommendation for further checking/ r+ v2 x/ A4 B" j! E# j, F
- 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! ^) }0 M1 D( j6 l
 the names of the two files compared! g7 o) x, E4 q; i
d) Leave the program (exit)
9 i$ v7 c+ v/ D, j. rThe ProgramCompare class: (Total maximum 20 marks available)8 f6 b! X8 H- m: n3 e
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)
+ X2 T/ n# H r: xa) provide an error message if the files are not found or there is a problem opening them3 x+ G; b! }2 h7 _9 x
b) compare each line of code4 y, |( r9 @1 |: v; k9 M- d- o
c) print out the lines that are the same+ h( Q" u3 k. w1 Q& A' t$ J
d) count the number of lines compared / lines the same* J4 M: p6 `/ m8 f% h* t
The AuthorisedUsers class: (Total maximum 20 marks available)
* F+ D7 X3 E% X" Y, Z8 k7 c1 r# D3. 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). K: H" Y$ v$ o" ?) g1 N
4. Provide methods to:" q% O" S! Y' H* m
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 match4 H2 T" G. k+ h" C
b) return the name of the authorised user0 U. j4 d0 G, I; R# }
c) return the name of the department of the authorised user
; M% x" o3 b, `3 i) t2 EIndividual Data (Maximum 20 marks available)# P. U) j6 o3 a2 T* f: y/ g5 _
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.
* K* w# m- Z f! A# yDocumentation (Maximum 10 marks available)$ ^1 y% b' w: c. |6 c: U, ?
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.
! B! V4 ]" P% O e* Q: VBSA104 Business Programming – 2007: Assignment 2
3 M, H( U% G0 o4 rPage 3 of 5 |
|