|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming8 m. {7 W2 v' M( s# s
Shanghai - 2007
$ |1 [$ R8 \$ c8 G; DAssignment 2
. A- U: _( W0 d0 R7 _6 MDeadline 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 E4 o& X- B0 k' a, |
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.( y+ b5 l9 t3 E* M* g
The staff must be able to: V5 p, y/ Z' S& L/ M
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **. ^2 X2 p* P3 @0 I$ j, r
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.
1 V, a, S0 W9 a' x6 m The interface should provide a menu so that the staff can:" \0 ?: C/ N L
a) Enter the names of the two Java program files to be compared# E6 C( n$ C6 X, _6 s; m2 E
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
+ j* d8 j5 I( |) p a** 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 z& I, x- m8 z7 N. _
BSA104 Business Programming – 2007: Assignment 2; {5 ~2 ~; F% z5 D7 t3 v3 y! r
Page 2 of 51 [8 S! A$ K7 `/ t
b) Print out to the screen all the lines of code that are the same
& U5 O+ z U% C- o7 j' s1 d Include the name of the file and the line number of the code being printed for each of the two files
1 [4 b& v9 I/ y: sc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
% G6 A( k2 _: l; m the name, username and department of the user
+ J9 T; T& i7 {0 `* T the statistics of the comparison
3 S0 J' s4 E$ D+ v- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
% m4 g6 r! E1 h$ } the recommendation for further checking
. A/ T2 L* g1 V7 J9 O+ V- 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 H$ V6 l# z- J o4 s4 e
 the names of the two files compared/ s8 u. r7 C2 c& n; C
d) Leave the program (exit)- o2 b! L% p& q, g) I& p
The ProgramCompare class: (Total maximum 20 marks available)+ _* `& H( p1 k+ p% b! L$ e# {3 g
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)4 H3 q* s" k% [0 }# y3 \5 O& `3 W
a) provide an error message if the files are not found or there is a problem opening them4 P: ]; D. r# S- I% s
b) compare each line of code
* d# o3 t( e( x2 Kc) print out the lines that are the same. M0 v8 G: T7 [
d) count the number of lines compared / lines the same
: x7 u( M9 ]& T& P& A( zThe AuthorisedUsers class: (Total maximum 20 marks available)7 a% S. |& q' i. L; j
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)( `6 B) F" z8 P3 f* f3 Z1 d
4. Provide methods to:
! T$ h* ~ b- b! ja) 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
# @" B+ N( M, @' C1 N2 r- bb) return the name of the authorised user& Q9 D4 y( ?( Z+ y: a
c) return the name of the department of the authorised user
) W. M" E9 i2 d5 v9 FIndividual Data (Maximum 20 marks available)+ x7 n# {- v% L7 o# Y5 L9 K9 {9 d
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./ @% L `3 d0 h
Documentation (Maximum 10 marks available)) a G& T2 t1 W
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.6 Y' |" [* P+ G: w( s+ K, I
BSA104 Business Programming – 2007: Assignment 28 |8 t0 m0 S- r0 a8 t- u0 C8 ~
Page 3 of 5 |
|