|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
0 ^" Y V( ]1 p7 |- G; fShanghai - 2007; ^5 h2 p/ a, |5 r3 F" }
Assignment 2
5 v/ B. x9 @; G) x4 _ ^ i8 ODeadline 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)
) ]& O9 O( d0 D6 `& X7 m1. 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.
0 o( [1 E, {! j" g8 tThe staff must be able to:) @3 a% \ X% K I/ U: h/ {
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.% d6 ` G$ x# H ^- o& J, e
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.
9 y+ n% t3 N I, W# A. S The interface should provide a menu so that the staff can:: P, l% d4 y. W6 ]! D7 W( k
a) Enter the names of the two Java program files to be compared: `# T, J! [! i3 _- N
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
2 C7 P; g, H1 t# 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).: b9 l, A' F, V1 \
BSA104 Business Programming – 2007: Assignment 2
% P, C0 W$ b6 r$ v6 P2 S' |- s$ j- TPage 2 of 5
" S% B8 d9 c1 u' k1 M& ^* d2 Xb) Print out to the screen all the lines of code that are the same! \# R1 \- i. N5 M" ~
 Include the name of the file and the line number of the code being printed for each of the two files
$ ^! q6 G! s. D; xc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
: Y+ B- i6 ~5 M2 e the name, username and department of the user; z& Z' P2 p# p4 E' Q
 the statistics of the comparison
$ ?) ?9 ^0 L( y. }1 w0 O- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different1 `$ z) y2 j3 I5 x
 the recommendation for further checking( u: `1 V% [+ @' V* 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
- S) n' P& g8 Y' i the names of the two files compared. c4 l/ S6 h7 l* z8 W; i0 z" E
d) Leave the program (exit)' J5 ?% [- [8 p3 Z) N
The ProgramCompare class: (Total maximum 20 marks available)
) l5 A" d" A2 r. q) `% V% |8 p2. 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)
0 G- Q- V% N7 @0 K% ]" ~; v. w* va) provide an error message if the files are not found or there is a problem opening them% ` m3 r8 [& o* P6 Q1 j; V e
b) compare each line of code8 a, `) d \. c/ u( b& s
c) print out the lines that are the same
: z4 P. k: |1 Bd) count the number of lines compared / lines the same% C9 }2 b7 E8 d" m8 w$ t0 x3 T m
The AuthorisedUsers class: (Total maximum 20 marks available)! k! [3 `* U5 \& b
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)
5 \/ Q/ ? f" h) T+ O7 _% }4. Provide methods to:
5 C) |/ k: l9 ]* z, la) compare the stored username and PIN with the one entered by the user - return a value that indicates whether they match or do not match6 w6 E: D0 O. P6 u% z
b) return the name of the authorised user4 q* x5 x0 X8 x6 x; e
c) return the name of the department of the authorised user. ~& x% l( f5 B$ m R
Individual Data (Maximum 20 marks available)
* W" o! J' b" q8 a9 k. o4 K" N5. 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.
[% C0 o3 x6 P. @9 `2 VDocumentation (Maximum 10 marks available)
% Z( X3 @* H7 M" ^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.. D" f) s4 P2 L
BSA104 Business Programming – 2007: Assignment 2
& u \- P' k& K/ N D9 l! {/ a) sPage 3 of 5 |
|