|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming( y2 \3 j& s6 ]( m2 a/ \, s- }6 `$ X
Shanghai - 2007- l, E2 ], `& W% G3 o& F
Assignment 2
' Z( |: w9 C' O2 D2 C( [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)9 [5 m' A8 g8 y2 q! V4 r
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.
' g+ D4 e9 l. T- k% x4 G% dThe staff must be able to:& G4 W$ H' {7 t$ g' _# D
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
3 b( H' s3 f6 X4 V1. 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.
% L7 `+ N4 m2 S' d2 ]9 L- g# Z The interface should provide a menu so that the staff can:. k) K! f3 ~2 g' |
a) Enter the names of the two Java program files to be compared
$ G+ K2 W5 _# Q8 {; B For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
: V: I$ w7 _/ ?; e9 k: O$ d** 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).; A/ }' _! W+ t6 c2 f& ]- |' {( ?
BSA104 Business Programming – 2007: Assignment 2
4 e( @' _ j7 @+ u* u sPage 2 of 50 P( K7 ^3 d% E, Q+ A, p! J
b) Print out to the screen all the lines of code that are the same
( k5 t4 P6 X) q X( K t* n( s Include the name of the file and the line number of the code being printed for each of the two files
' g. K. n2 z% M3 p/ Pc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
: e! Y9 h9 X: ^) d) g; D the name, username and department of the user
1 n- y+ ^* w+ V the statistics of the comparison
( E* X7 \& q- U/ x; ~$ E- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
3 n3 q! R% f; z0 M. z* p/ } the recommendation for further checking5 o9 s- _( d% i6 P% ?6 R: ^
- 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 closely6 z: C+ k' a. j$ M7 f l: e) g
 the names of the two files compared' M+ W! [, B# ?- j
d) Leave the program (exit)
7 Y( n# w. Q, Y0 I# D& Q' }6 pThe ProgramCompare class: (Total maximum 20 marks available)
4 r9 \' R4 ~0 b* U" S6 Q6 l2. 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). G( b- p+ L8 h, I# f: z% B
a) provide an error message if the files are not found or there is a problem opening them3 c/ a% z. H* k
b) compare each line of code
% C% g" C0 _2 B1 F: \& c E" gc) print out the lines that are the same/ e& \5 g; [- c0 S) ]
d) count the number of lines compared / lines the same
! o$ K) u5 b! C9 k- a5 h' r8 _The AuthorisedUsers class: (Total maximum 20 marks available)/ p) M( F( _1 K* x* o, k
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). |: A& Z' }0 Q4 ?% D9 l- s8 A
4. Provide methods to:
4 J8 I2 Y s% S! ^6 R" Ga) 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
2 [; b9 x9 k- d- [b) return the name of the authorised user
( P2 |' M% ?7 n Y1 Pc) return the name of the department of the authorised user! i- H0 \4 w! U) s; x. n P2 U
Individual Data (Maximum 20 marks available)- F. q* c2 u: l* Z
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.& Y- A- s6 q, ^, U! ]
Documentation (Maximum 10 marks available)+ _5 H- G( n% Q; Z( s$ d
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.
. y% h/ A, \( z3 n# q, F, j$ MBSA104 Business Programming – 2007: Assignment 2
1 a D: }5 A) x. ]/ PPage 3 of 5 |
|