|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming$ W, Y8 a k+ Z8 b! U
Shanghai - 2007% S- f3 V9 O& k+ f+ p, f! M" {, A
Assignment 2
9 y1 U+ I1 Q8 \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)
, p& |5 z4 q- W1. 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.
& R7 {1 z2 s( I: y: z8 `7 U5 RThe staff must be able to:
0 W1 m. k0 T9 y, i' M$ \: r Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
! A1 H ^8 \3 }7 O5 @2 k5 Y1 ^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.
4 W2 x3 W% y- J4 r. n% |& C9 m. O6 d The interface should provide a menu so that the staff can:+ X- S9 Z" L, l2 X
a) Enter the names of the two Java program files to be compared1 O' J" B: V* D0 ^- D) H
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
, a$ |) _$ |8 \* |7 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).
+ J& Y% V% Q# M8 ~BSA104 Business Programming – 2007: Assignment 21 Z0 V& U% c+ ^! v+ m, X
Page 2 of 5
8 u% H# V5 b. n {& }+ C, r+ d% cb) Print out to the screen all the lines of code that are the same
* k% N" y! o x0 m H! ?: x Include the name of the file and the line number of the code being printed for each of the two files) _6 F4 L( I# T# V M8 d
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
6 W) S' h' @/ P! j the name, username and department of the user( u! v4 N( F: n, P7 \, C
 the statistics of the comparison& J m u& f: I. q* _# ]8 N4 L
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different) K$ g' N o- O6 t e# W
 the recommendation for further checking3 ?( G' L4 K1 J- h' k& v; a6 d: }0 d0 Q
- 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
5 F& n9 w7 p X( ^4 C" w( X( S% { the names of the two files compared' p, ]( w0 q/ d- e, V' D, n
d) Leave the program (exit)
5 L- K4 S8 c% x4 v) O9 t* LThe ProgramCompare class: (Total maximum 20 marks available)
6 w; t( _7 H: f7 |$ W2. 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)/ u: d; V0 y+ ^ V
a) provide an error message if the files are not found or there is a problem opening them- N/ H) d4 S3 s- R, ^ e/ {
b) compare each line of code
5 ?, X/ F6 S2 ^4 U, Z3 Q5 Dc) print out the lines that are the same
1 K" A0 s4 D; l2 H4 S4 Z. |d) count the number of lines compared / lines the same
! w+ _ F! H( i S) K" {The AuthorisedUsers class: (Total maximum 20 marks available)/ j; u2 b9 k8 E& C0 ]' d9 o
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)' U9 R" f+ n1 \; |: \" p
4. Provide methods to:
8 v3 q2 z( K( F! ?6 Z5 T1 ]0 { }: L# {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
# m/ G' r1 [: u1 kb) return the name of the authorised user! ?) q& I, b" A6 O( K5 Z. v! X
c) return the name of the department of the authorised user
1 Q9 `5 q- b$ \Individual Data (Maximum 20 marks available)! [$ Q- f) f& ]: @6 N. ^
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.6 |/ |' T9 C$ H+ B
Documentation (Maximum 10 marks available)' ? S% K) O0 Q
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! ~, x0 y2 jBSA104 Business Programming – 2007: Assignment 2
7 o* o9 c+ J7 I% Z8 ~! UPage 3 of 5 |
|