|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
; Y5 B2 Y* z6 x# @: A8 _' UShanghai - 2007
: I3 J( Q+ A1 oAssignment 2
1 w8 ^: E2 N3 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)
1 j* H7 J' x0 q" V1. 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., {% {6 R% q( `( [
The staff must be able to:, I2 b3 F1 U7 S9 S/ j; T
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
9 Z* _9 t* e5 _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.
/ J! E. I! K& I: |. m The interface should provide a menu so that the staff can:
/ m6 ]0 u$ f" i& X# U: ma) Enter the names of the two Java program files to be compared
8 p0 S# L3 v) s" ?# b* K5 L9 E For this assignment, it will be assumed that the two Java program files are in the same folder as your program.) ]" R: T% Y3 L! L! i
** 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 l1 E, u$ L1 A+ T& ABSA104 Business Programming – 2007: Assignment 2. z8 U4 A7 O* E' n: S
Page 2 of 5
) m' N: _! Q/ v2 {& ub) Print out to the screen all the lines of code that are the same
3 U5 m* Y# c0 B" [& i K Include the name of the file and the line number of the code being printed for each of the two files: w0 T9 y$ K$ M& \) ?' [" @+ J
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared, ?7 Y4 y9 K/ p0 L
 the name, username and department of the user
% r: F1 K2 Q/ k1 y9 m the statistics of the comparison
* L1 J5 X; i5 B- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
" i/ |, t8 e; e the recommendation for further checking
: \0 r- M4 \. |- 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
" V# q. v* G0 P3 w, E/ T the names of the two files compared6 m; C1 Z \+ V0 U
d) Leave the program (exit)# \& t9 L) K F, M8 ^) I# y
The ProgramCompare class: (Total maximum 20 marks available)% s5 l$ v& p1 j) M
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)
( v& Q- ?' f$ d3 `a) provide an error message if the files are not found or there is a problem opening them" B1 G, q0 x5 U# U
b) compare each line of code
! i# \ D1 H3 a5 g! `c) print out the lines that are the same
. T# D; R4 G1 d* @1 ^9 md) count the number of lines compared / lines the same S o x- ^/ C% I5 v. w
The AuthorisedUsers class: (Total maximum 20 marks available)
; G' W4 f, V2 U1 o. j( V9 R: q2 n3. 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)
' ~0 B! U4 P F. C4. Provide methods to:
9 c# `$ H$ Z! S3 v5 Ya) 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: B2 e: h3 h. y5 }7 q
b) return the name of the authorised user
2 Z6 A$ @1 m! w/ t% Fc) return the name of the department of the authorised user* f. h5 N6 g& S# A. K5 \
Individual Data (Maximum 20 marks available)5 X: R6 k8 Z- g5 I& F. [! a) z! k9 \
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.& f! P% ^7 \, n* a1 ?7 V& Z
Documentation (Maximum 10 marks available)
0 A$ B5 D. B+ N, ^& x5 ~/ K6. 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. d- M1 D: i0 D- g7 U; m' [
BSA104 Business Programming – 2007: Assignment 2
/ k! F n" V9 `* V! L) j; l8 UPage 3 of 5 |
|