|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming, x9 y1 p4 [9 K: ]
Shanghai - 20078 O' z' b1 s" Z2 [$ V8 ~ h
Assignment 2
1 b) g6 m% d$ w4 TDeadline 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)
0 v# o l. o! t i4 f$ ~4 y1. 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.
4 S+ K/ G$ M( s( B& \The staff must be able to:
& o% k7 I4 Y0 H% h& q- b Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
9 Z: _1 Y9 m F) d4 x1. 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. M( c% S& h; U1 ]. K* i. Q
 The interface should provide a menu so that the staff can:' i# T- Z, q( i1 A6 P& B
a) Enter the names of the two Java program files to be compared
/ x0 y$ p) F/ _$ ~+ r& y5 s9 {( V For this assignment, it will be assumed that the two Java program files are in the same folder as your program. H$ r$ R6 {3 ?9 e; v N
** 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).
6 ]2 l0 H. _& Y, n( @' m& |BSA104 Business Programming – 2007: Assignment 2
( k: k0 |/ P$ `Page 2 of 53 _2 }$ h0 v2 P
b) Print out to the screen all the lines of code that are the same
% W0 w7 w0 q( j k: Z/ K Include the name of the file and the line number of the code being printed for each of the two files
* ^: O3 B- Y0 a; S( j. ~4 wc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
* m$ r1 K' |: Q+ b& G% T* z9 Z the name, username and department of the user; A! x& u, w% L4 k- B; f
 the statistics of the comparison9 _: }5 Z" b9 h9 T6 z2 _( T
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
' F7 R" k8 M- D* ~/ W/ p7 w3 Q0 ~; f- M the recommendation for further checking0 X! o+ I7 K) V9 j
- 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
" u% c) Y0 o8 _- F6 M2 T/ A8 P+ C the names of the two files compared
4 _0 F/ A/ O4 ^9 Z+ w& g+ l% t$ pd) Leave the program (exit)/ V% L* t# r: Z& v: g9 X' n
The ProgramCompare class: (Total maximum 20 marks available)
) G. J8 e5 V4 k5 |* o N: O2. 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)5 S* \( V/ ^/ p
a) provide an error message if the files are not found or there is a problem opening them$ q3 C7 f0 `( `2 \" p4 ^9 J9 v
b) compare each line of code7 D7 n( H' L. v# f
c) print out the lines that are the same3 Z- D4 @. b7 \3 i8 {* y3 ^
d) count the number of lines compared / lines the same
2 ~$ y0 y- b. k# M& c7 d6 @The AuthorisedUsers class: (Total maximum 20 marks available)
; z2 s4 N2 r8 n5 \! D0 b3. 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)
8 G! t, L2 x3 @; U- i7 b4. Provide methods to:) u9 W+ [% K) v
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
) b7 k8 r- n% R* Q) \' Ib) return the name of the authorised user" l: l" h9 N7 d+ \$ V$ F9 X" |
c) return the name of the department of the authorised user
4 U! T# g) b) h; a# G/ Y) q5 HIndividual Data (Maximum 20 marks available)( o8 v7 j) e: U6 y8 K0 @4 f5 f/ L
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.
& }6 e' x) s; P2 r( a J1 {9 VDocumentation (Maximum 10 marks available)1 D# y( I, L! u4 B3 B
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.
" J9 C s W. T" @! |1 K0 qBSA104 Business Programming – 2007: Assignment 2, o7 ~ m. T& k2 I: e
Page 3 of 5 |
|