|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
& g2 ]% N6 Y% C+ VShanghai - 20079 P7 h8 c: Z: H# } \
Assignment 2
- I* S( q* G: [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)
$ @; W4 t! `) P0 D# v1 \* v. q1. 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.
# ~2 q Y4 h9 n: \1 QThe staff must be able to:+ [+ q8 s7 h" \ k( I
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.3 C! x* g: I/ _3 b3 @: z, I
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.
2 |7 @; @1 ^ h* K( ?' C' y4 o% m The interface should provide a menu so that the staff can:
: l( O$ T! F" a# T4 v7 Z( Qa) Enter the names of the two Java program files to be compared
: G# H. {$ t5 B: V1 R5 Y9 k2 b For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
* j" t* k! F$ K8 q6 w2 t) n+ ~6 {** 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).
$ |1 z/ I1 {$ ]. P. vBSA104 Business Programming – 2007: Assignment 29 _6 E6 y$ L( W$ W
Page 2 of 56 I5 I6 |! w; ^ L6 S
b) Print out to the screen all the lines of code that are the same( E- f8 ]+ h! q' p' v7 ?
 Include the name of the file and the line number of the code being printed for each of the two files" D+ j; k/ a; c
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared. D- g6 t7 b9 k! U
 the name, username and department of the user
. c9 R- M, c$ ^ the statistics of the comparison; b" |8 a$ u6 o# S( e+ p
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
8 Z/ `( n5 z! A the recommendation for further checking1 b- A7 j& [& I
- 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
1 }- Q/ y; `* H the names of the two files compared
7 y9 a x: l, R( sd) Leave the program (exit)
' f2 g! g' q% z' ^1 h qThe ProgramCompare class: (Total maximum 20 marks available)9 c- [ v' Z0 _" j
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; j( u- }: z9 `+ `
a) provide an error message if the files are not found or there is a problem opening them* z* |* K' L4 }" i
b) compare each line of code
( m$ [( T2 ~0 `% Z( v1 o! w( Tc) print out the lines that are the same
, }+ I+ B# T% }7 nd) count the number of lines compared / lines the same
, x+ I* A& J# M7 v7 g& p0 CThe AuthorisedUsers class: (Total maximum 20 marks available)# ~# \1 q5 {4 U% @
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)+ Z: d6 ]7 o1 d% G; r' k
4. Provide methods to:
+ O. e& x8 i" G& y+ |- G2 s/ 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 match9 S% t3 o( t- q- l
b) return the name of the authorised user/ G) {, q5 ~8 o/ [
c) return the name of the department of the authorised user
0 H) b/ T5 e& EIndividual Data (Maximum 20 marks available)$ G. \, \1 Q* V) ]" u1 p8 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.) V/ f1 c, n! o, G/ [; B: c/ d1 ?
Documentation (Maximum 10 marks available)$ T6 F3 n, X& Z! l
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.
0 j* A6 [" b: D# x) N0 cBSA104 Business Programming – 2007: Assignment 20 V" x4 i6 c3 B' ?; T
Page 3 of 5 |
|