|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
; Q1 X1 D! h1 a+ E0 v- H$ i: N- FShanghai - 2007
4 U; ~* U& {0 W8 u% Z$ f6 x1 fAssignment 24 f& G: H; ]5 F2 p* 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)
$ s( n$ d- l: }9 [! l. a+ |; L1. 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.
( N9 M+ J7 f3 u: NThe staff must be able to:
! M) s1 a6 U- s* V1 y: Z. U Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.! X( w" }# K( l- C7 I9 Y
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.
) V* q3 v& D- k0 c, |" W! V The interface should provide a menu so that the staff can:
u7 R) u0 G7 W1 F- O/ ^a) Enter the names of the two Java program files to be compared5 G8 H( e( {; z% M. L) Q! B
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.' y d: W5 @* \: X* V5 U; s
** 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).
$ X5 y. f: d0 ^. a: zBSA104 Business Programming – 2007: Assignment 2 y5 o; M* j6 U" K: i( p: R
Page 2 of 5
. W2 Q5 V) u+ A6 w6 b, Mb) Print out to the screen all the lines of code that are the same: m3 F9 `1 ~& ?8 ?
 Include the name of the file and the line number of the code being printed for each of the two files7 c2 _2 Q( V, m; r
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared } J7 L8 k3 g5 m
 the name, username and department of the user: X/ m2 R! V' a
 the statistics of the comparison
, T$ r3 }* r U/ c+ M! B- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
9 q. z3 C" r8 n& d) N- V/ C0 [0 v the recommendation for further checking
% O% z2 b/ E. Q2 I/ {1 H% [- 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
2 ?' T. h5 i% C& a" _# o8 P f the names of the two files compared
; M) j. j- c+ D; Od) Leave the program (exit)
. y0 F L7 j5 wThe ProgramCompare class: (Total maximum 20 marks available)+ M* T: G O& f" e! j4 U
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)
1 r+ h8 m5 ^* G- a2 [ s4 J( _a) provide an error message if the files are not found or there is a problem opening them5 h% E& Q4 O7 f" t q% F
b) compare each line of code
( N9 ?. z3 P2 a+ R+ R+ Yc) print out the lines that are the same
1 k' W) `0 L, O* u$ b; P( K8 o2 z. ed) count the number of lines compared / lines the same
# Y L/ T$ P' [2 q J+ wThe AuthorisedUsers class: (Total maximum 20 marks available)
6 ?- Z; k8 _, O# Q3 I" L. Q3. 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)
9 v7 X- P5 W. ^# e9 V$ Z$ R8 V3 N! G4. Provide methods to:* I( o6 V( A3 `+ J9 H: h+ x k
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
. X- {% r1 J: p! Fb) return the name of the authorised user$ E. o Y5 g; |
c) return the name of the department of the authorised user
9 _3 l" t. O& H# _/ m/ w% |; H/ KIndividual Data (Maximum 20 marks available)
: ?* U7 p9 J- c2 |6 C0 y5. 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 z( `4 H9 ?8 e
Documentation (Maximum 10 marks available)4 P! c. k* r5 q1 Q8 s
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.
/ r. K( F n3 U- ~BSA104 Business Programming – 2007: Assignment 2
O$ E$ K s& d4 E/ a5 \/ ]3 G; ^0 QPage 3 of 5 |
|