|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
% M6 O5 q2 g" e5 nShanghai - 2007( Z+ B# y5 K- [# r
Assignment 2, Y* y" v! Y+ Q* @) h
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)& P% i t0 c* G/ f: _4 Y0 k
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.6 J; D6 a5 d# n7 M1 K
The staff must be able to:, b5 T& K6 S, |& Q1 d' k6 f
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
' K1 ~; A; y" I7 n7 K3 A% S1 ~4 K+ }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.
6 D4 k: n5 \ F+ o, H9 n The interface should provide a menu so that the staff can:8 w. P! o0 M) ^) b, W# z: Z4 F' G
a) Enter the names of the two Java program files to be compared/ p! O2 K. y! O6 b, d8 |
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.' e C0 s) s9 p' c& 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' |# U9 t- H/ S7 WBSA104 Business Programming – 2007: Assignment 2
* k; g: f0 W" \, D) f+ ~Page 2 of 5- R" \* f, k; [) d
b) Print out to the screen all the lines of code that are the same! Y5 P5 K9 U4 k3 G/ x
 Include the name of the file and the line number of the code being printed for each of the two files6 ?) h6 P' J; q: Y' ], q
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared/ u6 r8 ]& d8 Y. U" q9 G/ I; Q6 f
 the name, username and department of the user
6 S |) V6 U" C3 u: P6 A- j. n6 i the statistics of the comparison' i, R( w, b( a8 \$ ~4 k7 W
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
/ N- }# E/ H/ M' k. o the recommendation for further checking
8 ^& [$ c- C3 H; Q- 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
; W) A2 D$ I: `" L; u! A9 q the names of the two files compared
/ l0 @& d& X" |* n* Bd) Leave the program (exit)- Z: M1 x) V! f1 c3 q
The ProgramCompare class: (Total maximum 20 marks available)
# P7 { _% w& z& k0 B4 }. V2. 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)
. z3 U- @/ f O; W+ da) provide an error message if the files are not found or there is a problem opening them
i0 ]+ M/ l+ c! r7 @b) compare each line of code! ~1 J+ a! D; S# y& X
c) print out the lines that are the same
4 N5 E0 B! j8 ~d) count the number of lines compared / lines the same1 L% C5 r5 l% |1 _# g% ~" ~! \) G
The AuthorisedUsers class: (Total maximum 20 marks available)
# ~6 I9 Q6 T& U8 d4 Z3 d" H3. 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)
& o5 q/ K" a; |+ O) k7 k2 x7 J$ S* u4. Provide methods to:
& {3 i+ M0 _; [0 a$ W, @6 [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 match0 {+ s9 B. g: @( w
b) return the name of the authorised user- C1 J6 M$ [2 p7 k
c) return the name of the department of the authorised user
% w- w9 t, g* s: Q$ @Individual Data (Maximum 20 marks available)8 e5 b2 u4 \4 K# y6 Y! p
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.
! t1 a* P# U) r& `; gDocumentation (Maximum 10 marks available)% R: p9 g4 a3 i) T% E" t5 g* Q
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.
7 W( f$ b9 y$ Y! r3 `BSA104 Business Programming – 2007: Assignment 2
" K1 A' f7 K2 \# E9 }0 Q8 pPage 3 of 5 |
|