|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming% V! L S6 w g9 u. s
Shanghai - 2007$ Q r" J7 |) f* A9 g$ h8 h6 [
Assignment 2
4 k& p$ z% N! [9 E4 B. d7 jDeadline 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)
; x0 p a! i, q% E9 T1. 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., `( e3 H7 T$ c% t* ?
The staff must be able to:
) v+ c8 F* i+ A& Q1 G* Q Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
( `% [; P& U1 E4 q* y1. 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.4 W, U: r5 d0 Q' S
 The interface should provide a menu so that the staff can:( Q4 O1 O/ y8 R% e& Q& X
a) Enter the names of the two Java program files to be compared
2 s5 R( {$ }, e0 B For this assignment, it will be assumed that the two Java program files are in the same folder as your program.+ ]8 l j1 q$ 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).
. [% [7 T9 A# ?) h2 v1 h H/ L. qBSA104 Business Programming – 2007: Assignment 20 R5 ?% o, i: u
Page 2 of 53 F: S+ j* @, ^8 a4 f3 k2 N* ^/ t
b) Print out to the screen all the lines of code that are the same
) K/ [: g, i' d9 o5 Q3 G, V Include the name of the file and the line number of the code being printed for each of the two files
% p4 Z' C8 U* Y/ _3 a- |c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared& d) B* L/ _; \ R5 L- A& I5 |
 the name, username and department of the user* W3 o$ C8 {7 S0 R P: O8 A0 u
 the statistics of the comparison3 C/ ]0 P0 E, ~, R) ]1 `9 P4 G) A/ q
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different0 w$ Y# w& k8 \( h4 f# P
 the recommendation for further checking% |, g# c; G3 } e" w: R* Y
- 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
% l" q1 N: G* v' [ the names of the two files compared
! l2 I7 t; b; }* G4 md) Leave the program (exit)
4 U! W4 Y; {. q' Q9 u2 F. WThe ProgramCompare class: (Total maximum 20 marks available)# U/ x- Z. Y4 \% [; 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)/ _/ x' e: M3 q }1 ~
a) provide an error message if the files are not found or there is a problem opening them
$ u0 _! L+ i7 E6 \b) compare each line of code7 B' w2 Q1 @2 r/ i( n/ }9 }
c) print out the lines that are the same) H! j8 `7 j6 p; m5 @, j3 |! u
d) count the number of lines compared / lines the same! e9 Z' i7 K7 ]5 d6 d; [
The AuthorisedUsers class: (Total maximum 20 marks available)
7 ~2 ~4 B* \6 B! i; Y7 r8 E3. 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)
; s/ C* q% Z/ z* c4. Provide methods to:3 C5 A& F6 ~7 m0 J4 ]
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
/ L$ B# `3 C( Eb) return the name of the authorised user
$ [* N8 A! O; n! h `1 Uc) return the name of the department of the authorised user
e- i! x" w6 H7 @( wIndividual Data (Maximum 20 marks available)
. d. |0 m4 c& Z y1 j5 ?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.
) `( e+ l, g# e/ D4 a+ QDocumentation (Maximum 10 marks available)1 o6 @' `9 X' j6 n- V5 P% C
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 X& ~5 H) {* T9 c$ x' q
BSA104 Business Programming – 2007: Assignment 2
1 C7 F: b! r7 i- ?: ?, W+ OPage 3 of 5 |
|