|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
5 Q+ S" [* @( ?4 {) C- y1 TShanghai - 2007
0 {2 [: X F2 v- {* K# c# {! IAssignment 2/ H' S+ F/ o, t
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)
, Q- r' f/ i9 g- n0 W/ p% e1. 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.- a- P! h' e( ~1 h: K4 p, J: V
The staff must be able to:
1 k9 r! _# {9 x0 K, i; L Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **./ \$ v' Y1 Z: g$ ~1 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.
g( i! u& t2 \" ` The interface should provide a menu so that the staff can:, o6 e9 t5 ^6 L* n
a) Enter the names of the two Java program files to be compared+ ~: l4 ?* e5 p3 `0 R. R
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.6 H0 u5 T) X4 G, y( @- y- 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).
+ O$ ^* o% B6 l: w7 lBSA104 Business Programming – 2007: Assignment 2
0 [& r P+ V" jPage 2 of 5/ m4 J3 J& u# ]+ ]& q3 M/ H7 b: Z
b) Print out to the screen all the lines of code that are the same# m( L9 R1 B1 u* u: D2 t* \
 Include the name of the file and the line number of the code being printed for each of the two files9 m+ A. f9 a2 F2 O0 |; V
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared0 r! c! ~; ?4 h/ t) S& S) E3 t
 the name, username and department of the user% o T& _. F M) W+ i0 D* I
 the statistics of the comparison
7 K" J6 _" _& ^; J# M7 B- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different5 J$ K( @' I( F+ `
 the recommendation for further checking
' H% N5 K1 b# a1 |' H# b- 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' z, s+ ]3 z; z/ p3 w( Q
 the names of the two files compared1 t. z( V3 I/ K6 I# Z# T1 e& P+ a
d) Leave the program (exit)
" J0 G. @$ ^7 O3 b2 o$ JThe ProgramCompare class: (Total maximum 20 marks available)+ T" K E I$ `" ?0 L* B
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)- l/ `* a8 N4 r+ [" |4 a# u* N
a) provide an error message if the files are not found or there is a problem opening them4 c1 O7 c# y/ U& }6 J/ v! d# }* w$ y& J
b) compare each line of code
) g! ?+ ]' M- U u: t k, hc) print out the lines that are the same- B( I7 K% f1 w( ?! f" c) Y+ `: S1 d
d) count the number of lines compared / lines the same- M: {4 |6 D8 U- _0 \$ z. \
The AuthorisedUsers class: (Total maximum 20 marks available)
; z0 t j! J. k- 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)
3 }3 G4 K6 K! n& b$ m: I% h0 J4. Provide methods to:9 [1 u1 q3 j% h
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 match6 r, V# m/ `7 Y
b) return the name of the authorised user
: b. d# r% W; k# h" nc) return the name of the department of the authorised user. i" z) Z+ x' T+ _& S( X/ `4 Q4 W
Individual Data (Maximum 20 marks available)5 b3 U5 k+ T3 T1 c
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.4 N5 \# _+ G; r4 w/ V# w9 J2 x
Documentation (Maximum 10 marks available)% n) d' I# J3 n) O6 t$ ?! \5 E
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.
' S u6 X! D& d# a' L8 M5 h BBSA104 Business Programming – 2007: Assignment 2
; V- H% x5 c% e/ C6 b2 I: wPage 3 of 5 |
|