|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming F0 a) q: v ~0 C7 F; ^, L
Shanghai - 2007$ f$ l# k0 D& }1 K' B6 Q( b
Assignment 2* [$ d+ T5 r) }6 B) y! M& U% U
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)
0 r4 L* P; S l! x" ~; z# U1. 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.
9 J2 O7 p" M w2 I7 IThe staff must be able to:
. f* B, l7 E; U' F- D: v5 x# y Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.0 Y; l: w0 G9 X, b8 B G% N
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.
* i; T4 W* y2 t* A The interface should provide a menu so that the staff can:
* F$ g. R; p1 D# P& U# C$ ma) Enter the names of the two Java program files to be compared
. ^5 _% E& k* \. v1 \% g, z For this assignment, it will be assumed that the two Java program files are in the same folder as your program.7 y) Y+ R, _2 N1 j- b4 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).
* U- }9 @4 |/ o/ [: TBSA104 Business Programming – 2007: Assignment 22 q; A/ R4 o. h5 c. K
Page 2 of 5( K* A2 s; T" L- l$ b( W0 M/ r6 g
b) Print out to the screen all the lines of code that are the same% V4 X! r: I* f" |) y" J4 H
 Include the name of the file and the line number of the code being printed for each of the two files; g ~5 N6 B) D L+ |# X/ v
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared3 h: w/ v$ Z! W% y
 the name, username and department of the user4 [( {0 V( l) N4 u$ q
 the statistics of the comparison
0 }. V8 _! ]" D! Z5 W; c- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different3 F0 v C, u: P+ u/ Z$ W5 E
 the recommendation for further checking
1 a3 Z! T2 e f( ]2 j- 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
- i8 T1 s0 H K1 k5 Y E the names of the two files compared
( [* W0 v/ i: a; v* |" Bd) Leave the program (exit)* S0 P! e6 Z, A
The ProgramCompare class: (Total maximum 20 marks available)
$ r0 i4 b% R: W, \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)
0 E& K5 ^: ]3 a% w+ Ta) provide an error message if the files are not found or there is a problem opening them% s H% m: u7 D: ^0 y/ n2 ^
b) compare each line of code. U _4 l. B% ]3 t' s* M4 C
c) print out the lines that are the same
2 u" W0 d, n' g3 sd) count the number of lines compared / lines the same( W, U- b; \- c% W" V
The AuthorisedUsers class: (Total maximum 20 marks available)
- u6 h$ G6 h8 z4 ]5 K3. 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)9 F$ @# S& Y1 f
4. Provide methods to:0 x4 D3 t" |0 o7 b3 j* A
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 J6 i: m, m) W1 I. S: c/ cb) return the name of the authorised user, K" g- y0 D2 T8 W1 Z5 ^0 I w3 t
c) return the name of the department of the authorised user
& o) |) F+ C: p! n8 nIndividual Data (Maximum 20 marks available)+ ~+ i3 A& | ~# f! K( [9 {( ^, f
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.
A! Q* }, M5 E3 gDocumentation (Maximum 10 marks available)
% M! Q2 u$ I& N6 p6. 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* a6 n; \5 R4 h5 t
BSA104 Business Programming – 2007: Assignment 27 D; O+ J: z! X3 P) f
Page 3 of 5 |
|