|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming! u/ `; Q) h# _& A+ i
Shanghai - 2007+ d2 g" W8 T4 z' W
Assignment 2
3 f7 j) [7 R3 j% WDeadline 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); m* C& f: x% l9 ^+ y
1. 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.; l& m+ w2 `& h7 ~# t/ D h$ Z0 e
The staff must be able to:* g- {% ]% `: w2 r7 X) B
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
% z& t0 A( f& J2 B9 J2 |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.) w/ ~2 E, R4 N5 L+ ]7 m& y' _
 The interface should provide a menu so that the staff can:
5 `( t2 e! K% Q, s2 r/ O2 ea) Enter the names of the two Java program files to be compared
U, m4 ^, N. g! A. P z& y0 @ For this assignment, it will be assumed that the two Java program files are in the same folder as your program.! a l5 h4 ?, I0 f
** 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).: `4 }5 X0 K8 v/ [
BSA104 Business Programming – 2007: Assignment 2" h( f5 z$ E2 ^1 s) P+ b6 B' `: M: h
Page 2 of 5
& ?* K3 I8 \5 qb) Print out to the screen all the lines of code that are the same
4 b. M0 _# k+ J% P Include the name of the file and the line number of the code being printed for each of the two files. B+ ~, R9 I7 l' S2 J9 Z9 }$ B
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared2 y7 ]7 P% S3 G( t
 the name, username and department of the user6 E W7 L# h/ l( i- Q5 A( r
 the statistics of the comparison' z7 w0 ~1 q% _5 B
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different5 X- T: e% w6 R) \9 I6 @
 the recommendation for further checking
/ ?. ] ^" I2 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: E- R: M9 g& e8 y
 the names of the two files compared
6 ~1 x* K3 S6 Wd) Leave the program (exit)
! t' y2 u/ ]4 A+ gThe ProgramCompare class: (Total maximum 20 marks available)
+ W" }* f2 W, A6 k* j6 Y2. 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)
+ F; ? D2 [" e- i) T; g: la) provide an error message if the files are not found or there is a problem opening them
3 V) Q) s# L0 V" V+ ~# B( H6 Xb) compare each line of code6 r% G% D& n s7 T: g3 w/ i+ J r' p
c) print out the lines that are the same
- {; ~; {3 v6 P+ q; r) N$ H m2 vd) count the number of lines compared / lines the same6 ^: c) C; e: `8 M# Z$ Q
The AuthorisedUsers class: (Total maximum 20 marks available)
# D) L# @* y( Q( k% E; L- y3. 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)
, r: T2 y. s; W/ F2 z+ X4. Provide methods to:
2 c6 j( F1 @! I S* L3 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 match1 o( j! s& T( z
b) return the name of the authorised user
% O8 F8 a- a. A' y) p- j6 B- e0 jc) return the name of the department of the authorised user
Y( \+ u# |1 ?* yIndividual Data (Maximum 20 marks available): A$ G }6 o# ~
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.. K% d' L! t8 L E O
Documentation (Maximum 10 marks available)3 q7 M! {* z0 M. S6 r" k
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.
+ l3 P; T; ~; T ?& ^6 V: qBSA104 Business Programming – 2007: Assignment 2
8 n# t2 |4 i, ~! `+ _1 t4 OPage 3 of 5 |
|