|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
2 M& R( z! k% _; K' o' y7 D6 M8 KShanghai - 2007" P8 W: g$ C5 j1 a% a& ?) H1 t
Assignment 24 r ~8 K5 ?9 O5 C
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)" l( z1 f5 |) k! A* ]: d J
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.2 S/ A& j* r- ^4 r2 _
The staff must be able to:
, s$ F. W8 M8 V& ` Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.2 T- K5 S7 L# y( C/ ^8 V' q! c
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.
% H3 Y5 v7 C& R3 B$ J6 P The interface should provide a menu so that the staff can:, S* `. b3 U; B: K8 ~
a) Enter the names of the two Java program files to be compared4 i6 B" a, C: I) }! n w
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program. J& u$ }1 m; m3 x) X% m4 B
** 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).
* O+ u X: `* Y( l4 FBSA104 Business Programming – 2007: Assignment 2& J7 I j& K2 Z/ b
Page 2 of 5
: c& i" L3 F+ Z3 hb) Print out to the screen all the lines of code that are the same
. [' }* n6 e; m& B' ~, ~, m Include the name of the file and the line number of the code being printed for each of the two files
, w1 ~) m2 \2 B9 Oc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared1 l& v# E" |* v8 Y' `' p1 Q4 {6 L
 the name, username and department of the user
R7 j* o4 u8 F7 z9 l the statistics of the comparison
% K% ^1 s: A, b( \4 z- R+ @) X% z- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different! E2 k& p8 {1 F( H" J( ~* Z: d
 the recommendation for further checking& Z5 o$ M$ N5 u% u! 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
& N1 x1 ~6 U+ T/ _$ y( I/ _ the names of the two files compared6 x# z! k y* C- |' A: V
d) Leave the program (exit)
1 L( t& F, j" e$ h* a R9 V& gThe ProgramCompare class: (Total maximum 20 marks available)
/ Q+ e6 O! q! e8 J% c2. 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)9 X6 i% h. Q5 a- p% Y
a) provide an error message if the files are not found or there is a problem opening them# e1 S3 P4 z* j2 K5 W
b) compare each line of code
7 C) `3 X# V- ^2 v1 X# ^7 v+ vc) print out the lines that are the same
; ^8 j' ]/ }* _9 gd) count the number of lines compared / lines the same3 ]% I& L" I0 a. e% {
The AuthorisedUsers class: (Total maximum 20 marks available)2 K$ N% Z; C+ `7 ?5 ?" d: L
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)' x2 z, c) i g$ I, J8 x3 p
4. Provide methods to:
% {2 Y* e( U$ o& x( W/ M3 wa) 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/ ]) t, S/ n/ Q% v. p
b) return the name of the authorised user0 G: N% e A( ?* B3 c8 d
c) return the name of the department of the authorised user
$ J. F" i% {8 M# LIndividual Data (Maximum 20 marks available)
0 R/ k, ^! }' d; J3 C' z5. 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.
. B% |3 T2 B% n7 d, j9 S& t8 q ~Documentation (Maximum 10 marks available) l2 {9 ]- f, p
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.* p4 ?2 l# Z1 P. X; j9 O: y0 \
BSA104 Business Programming – 2007: Assignment 2
* [( K: @. B2 d9 q4 V {Page 3 of 5 |
|