|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
( M. y* T; B/ C* DShanghai - 2007
7 M2 r. g! R/ ^" O5 w$ jAssignment 2
; n" F& M3 B9 YDeadline 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 V- r- M; K- f/ U7 }
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.# m4 O; T+ g& h, Y$ D3 u
The staff must be able to:
5 k# A& S4 O4 g" v Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
8 a. c' N5 ^/ s* K3 @2 k) v* O1. 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.
Y8 @8 T' t5 m, o The interface should provide a menu so that the staff can:0 Y3 _* A4 j Y4 ]# z5 q
a) Enter the names of the two Java program files to be compared& G. A; |8 f( ]5 _& y" V
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program./ b3 g8 u2 K3 Z7 A8 ], w
** 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).
) n/ @% Q+ ~. b* r% X# jBSA104 Business Programming – 2007: Assignment 2
3 y+ _0 u7 C3 CPage 2 of 5
8 r; G; J _8 B: H& O7 s% y( P! l# ?b) Print out to the screen all the lines of code that are the same& M7 }- E: a9 H/ ]. E' B/ K( H7 m
 Include the name of the file and the line number of the code being printed for each of the two files- R* F. v1 _0 x# k
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
! q) q& R" a- m0 r ] the name, username and department of the user
2 w o: r* n h* x8 u8 @' Z& y the statistics of the comparison0 p$ E( _1 ^, N4 c1 r
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
! \# C( i! Y0 W+ n/ O the recommendation for further checking
2 W0 d# M6 `# r- 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
- s) B% ^5 d2 x! D: i the names of the two files compared
' r6 P! {3 p7 Y( v' fd) Leave the program (exit)4 `' A% g1 u! k8 M5 X% m. \
The ProgramCompare class: (Total maximum 20 marks available)* Q) Q5 Y. ^* r& P: J
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)
6 l K0 K2 o6 F* u6 u) _a) provide an error message if the files are not found or there is a problem opening them. G D7 t: I! ^2 b% \1 Q$ h; h g
b) compare each line of code
g1 r, T9 z# D; X' e, Qc) print out the lines that are the same
, t1 @1 T) j$ C% ^d) count the number of lines compared / lines the same
6 _& R/ A1 z& Y+ Z% TThe AuthorisedUsers class: (Total maximum 20 marks available), n$ g" N: l% B! r; 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)
% O/ Z. H! m' m# D9 ]4. Provide methods to:
8 [- h6 {% v; t% O0 oa) 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+ R+ V& T: R# A- t% T
b) return the name of the authorised user
p9 P9 @/ @) u# E5 Bc) return the name of the department of the authorised user1 k' s2 Q1 F0 [* \5 v
Individual Data (Maximum 20 marks available)
, s9 `0 `( c- U. m- ?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.+ m1 \. O5 R4 a7 c+ D: x
Documentation (Maximum 10 marks available)
: A6 i9 \( u4 ]% j& C6. 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.- I( r& { k2 z6 [+ ?# _, [
BSA104 Business Programming – 2007: Assignment 22 i# @1 K0 Z2 c; c: T& y
Page 3 of 5 |
|