|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming+ @1 ~# N: D# D/ y1 c+ F/ f
Shanghai - 2007
5 z. S( v: ]* B* `! ~Assignment 2. z F- V* C0 t* N& I! S
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)$ y: x, w; }2 x
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.
/ K( Y! B+ U Y, A4 X7 g9 r1 j2 gThe staff must be able to:
5 P O* A g# X& e- T3 @& e2 C9 P. Z Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
% m% E* d/ D! J1. 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.
% A, w n. `' e7 { The interface should provide a menu so that the staff can:2 D( V5 c" R% B% z( p2 O& l1 g* u
a) Enter the names of the two Java program files to be compared3 B& x: J4 h% {# Z
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.1 H" k/ q( S, x$ |: [
** 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 L% @1 A. S; l. r0 ^0 f
BSA104 Business Programming – 2007: Assignment 2
( Z6 D0 s3 M% h; |Page 2 of 5
0 Q: n ?* B$ g9 b8 g2 ]- H7 N( Rb) Print out to the screen all the lines of code that are the same
s' R0 T/ }1 c/ a. J1 V4 S' z Include the name of the file and the line number of the code being printed for each of the two files
2 y. q* V* ` ?0 o+ p6 ]0 Sc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared( O7 H8 H; |& ~6 C2 m, B& \; n7 W4 n
 the name, username and department of the user
n0 W. m+ K% j( [" o the statistics of the comparison
. e2 ?* _( }3 z6 _( U; q Q8 M5 E- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different# \% V. \. g' n2 h
 the recommendation for further checking
- F6 Y- Q9 o. h) s8 K- 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% j) ]# c3 f+ O8 [5 J2 T _. A
 the names of the two files compared
' g1 I: [0 e/ h7 Jd) Leave the program (exit)" E* Y3 h1 ]( X5 H3 Z
The ProgramCompare class: (Total maximum 20 marks available)4 q- a# L4 n& x7 L2 {$ Y+ j! Q
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) }( ]2 q G0 ~2 S7 s8 Sa) provide an error message if the files are not found or there is a problem opening them' O% @; ^& i9 H4 _2 W a+ ^
b) compare each line of code; ~& A/ h/ m* ^) v, C- n
c) print out the lines that are the same
6 C( c) T7 l+ L* Td) count the number of lines compared / lines the same
; C/ x8 l7 o& J3 ]The AuthorisedUsers class: (Total maximum 20 marks available). x8 _1 q0 J0 X; k$ c2 F7 Y, E
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)! Q o# F/ u9 F- |; o
4. Provide methods to:
* A4 e+ y3 ~, r" n) |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
9 z+ R) E, L O$ `. C6 eb) return the name of the authorised user
) X4 g2 O9 V0 i8 kc) return the name of the department of the authorised user/ H: M; ^2 w | J1 d* G1 L6 P3 q
Individual Data (Maximum 20 marks available)) m9 b8 p+ N8 x7 k" u7 d$ N% V. R
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.) }: y3 k+ q2 v$ H3 }8 x
Documentation (Maximum 10 marks available). O3 s3 h" f0 S" P: z2 [9 F
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.
8 m* f8 N- \+ r) g9 o6 H6 WBSA104 Business Programming – 2007: Assignment 2
, E/ k3 B1 g% ^8 QPage 3 of 5 |
|