|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming+ n# @% d% s) I2 \1 k5 G
Shanghai - 20076 e2 d- g7 C& Q, y& i2 }4 z
Assignment 2, @/ _1 I; p! Z) L- A' `
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)
( d' V |6 b# i: i1. 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.
8 A: m( q) F7 D% r" nThe staff must be able to:1 t* `7 b6 j [
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
: e4 [* |5 `0 L* w1. 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.
% ?# L/ R+ C6 @. X8 \3 C The interface should provide a menu so that the staff can:) H |5 o S3 h* ^ Z
a) Enter the names of the two Java program files to be compared
3 K* Q5 u' D/ A: w2 W" V; Q0 } For this assignment, it will be assumed that the two Java program files are in the same folder as your program.4 |! [4 s3 W4 X4 y1 ^$ V
** 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).; R% c- z0 W9 U, f
BSA104 Business Programming – 2007: Assignment 2
7 y/ A7 V3 r7 S+ J% A( G/ E. XPage 2 of 5( [/ S! q* s, O/ x5 O
b) Print out to the screen all the lines of code that are the same
6 }% D+ `6 w3 V- U Include the name of the file and the line number of the code being printed for each of the two files& \+ j% a6 ~" G. P5 b/ Q" G, ^1 D6 [
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
& [) ^6 N" U4 i9 v1 p" Q the name, username and department of the user
( ?! W2 i# B6 J- n0 W) I the statistics of the comparison8 M, o1 W! T$ N' _
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
7 S: n$ E, D! }6 H+ o4 ?% K the recommendation for further checking2 g+ B$ M) @/ d) z- ^8 `
- 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( d% E' M+ N1 P3 A7 f
 the names of the two files compared0 w( F3 |# o7 W3 y: W5 x1 K2 K/ z) k
d) Leave the program (exit)
% X- n+ N( E9 Q4 T9 s6 MThe ProgramCompare class: (Total maximum 20 marks available)9 A4 o/ s$ A$ N4 n: Q- V
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) ^: O: h' I: n8 W% ]$ c0 D- U: |: ma) provide an error message if the files are not found or there is a problem opening them1 {% X2 Q2 x+ d; C. ~
b) compare each line of code
. x1 o, T5 I! R1 e, \3 h3 C' W3 {c) print out the lines that are the same2 ^' K7 \) ~# u6 o
d) count the number of lines compared / lines the same
: o* Q8 l D/ _' }* WThe AuthorisedUsers class: (Total maximum 20 marks available)
2 ~8 q" e) h1 O+ p& g) 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)
- ]1 G2 P3 a' O5 R4. Provide methods to:
9 ] T8 R4 D" c/ L9 _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
! _0 H2 c* F( W+ y+ O9 jb) return the name of the authorised user
$ Y' t0 i2 R7 i. f7 sc) return the name of the department of the authorised user
! T/ B. k# Y$ _Individual Data (Maximum 20 marks available)* t8 E. S4 S3 `# _
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.
x9 Q5 T0 b! l% O8 x5 d1 f) g3 T0 I4 |2 _Documentation (Maximum 10 marks available)
0 N2 i$ I4 N, C- i/ }( X/ Q6. 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.' x0 ]5 l: k" ~
BSA104 Business Programming – 2007: Assignment 2
2 \2 N8 G& Y' j7 \6 s- y( rPage 3 of 5 |
|