|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
9 }* V' L& n! V3 O* _Shanghai - 2007
! s. E) t& ~3 b: O5 ^Assignment 2
) p' n; ]( N4 `$ Y+ Q& s& Z6 QDeadline 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): A" h! _0 r! G8 o( G1 v' ]
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.
$ t& L* M- ?* m/ V" K( Q' p5 _' _The staff must be able to:
; E( Y# f c0 I% H9 p; s: ] Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.# N: q1 z& ~( F9 J) Z( t: g
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., E/ w9 v3 _* Z' }) z
 The interface should provide a menu so that the staff can:0 d |# j( w) S' P7 M1 V# M
a) Enter the names of the two Java program files to be compared
n& ]$ @6 d: k5 ?% {4 y# } For this assignment, it will be assumed that the two Java program files are in the same folder as your program.$ j6 ~- k2 z6 S: [' i7 _# H9 l- |
** 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).
! @$ C5 m" ?% p3 F8 f5 T; nBSA104 Business Programming – 2007: Assignment 2
. y5 B) L2 \" b! Y: M) uPage 2 of 5- F+ p: r; s# Y- X
b) Print out to the screen all the lines of code that are the same* U' X& g6 B* U; \, F
 Include the name of the file and the line number of the code being printed for each of the two files
" C% u9 g$ k- o7 A6 v& S1 }3 gc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared# |/ x. f- R- J# ] _' |3 v; b
 the name, username and department of the user$ N# q( {, E9 n; s3 q' s( a& k
 the statistics of the comparison
! `9 D# d7 b- Z$ a/ g8 k- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
8 W: A& x7 ^7 h+ {; V the recommendation for further checking# x& u3 U1 A8 Z3 C3 y
- 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
! n* b! t3 X7 `$ a the names of the two files compared
4 a" `" u0 V! s8 X' @8 }# ^5 K" fd) Leave the program (exit)5 `* m0 ~0 b! t2 j" X
The ProgramCompare class: (Total maximum 20 marks available)
) P# o+ K, a% v0 z4 H2. 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)
4 I2 q# }4 C; ua) provide an error message if the files are not found or there is a problem opening them7 u6 A- ?- C8 U8 W9 `. p! ~
b) compare each line of code
" I9 R+ m, g) y1 e9 t0 Kc) print out the lines that are the same% t. _' ?! z. n
d) count the number of lines compared / lines the same
1 F' z) t# b7 g* P" UThe AuthorisedUsers class: (Total maximum 20 marks available)
. c9 U9 h9 Z" z/ P/ }5 g3. 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)
* u) _3 @, W; l+ @' }4. Provide methods to:
" {! V4 x1 z4 B$ Q) _: Y( O2 Va) 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
! a; H5 w) k3 D4 F" Tb) return the name of the authorised user
; s( I0 V" g: y5 yc) return the name of the department of the authorised user& ], P+ G( ~. T8 ?
Individual Data (Maximum 20 marks available)% u$ e4 k \2 p( e- ^( {
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' V4 l, s; k% R* r) KDocumentation (Maximum 10 marks available)
5 F! B P% k7 z+ w7 F4 t* `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. o, ]3 d* O1 B! s( t
BSA104 Business Programming – 2007: Assignment 2
: H& }- |" o5 E. uPage 3 of 5 |
|