|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming2 P, ]8 }* c7 B" |1 k
Shanghai - 20073 `% J' z2 r" P: ^+ p9 n
Assignment 2
' Y& q0 y/ d3 J- a+ ZDeadline 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)
$ V) {2 P% {) m+ t1. 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.
* j' X Y9 j: pThe staff must be able to:. q3 A' R* r% j' L/ I# }
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
! H0 n) @- l% P. c1. 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.
$ Y( D4 a4 h4 j$ r5 C* R( v The interface should provide a menu so that the staff can:+ b; e4 u, d: k" B
a) Enter the names of the two Java program files to be compared- M; o/ r9 B; X
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program./ r9 s( a" D/ S6 r9 \* a* m) m6 ^
** 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).
+ u7 ]% p: K7 e4 V6 vBSA104 Business Programming – 2007: Assignment 29 i; D+ F* w7 w
Page 2 of 5% M. S1 i# n/ p8 U
b) Print out to the screen all the lines of code that are the same5 c" a g$ }+ G- L
 Include the name of the file and the line number of the code being printed for each of the two files
- S* z" G- ~# k$ J2 i% Vc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
2 N) [2 E" J g' K6 g! _ the name, username and department of the user
# O: O" ]/ I f, [5 X+ J" L9 ` the statistics of the comparison+ F0 R/ Q* R, s& l6 F% A' k
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different3 k2 h8 U1 v! A9 D4 I6 l' O
 the recommendation for further checking) t0 x6 m' F2 u. _* N& Y- V
- 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$ n2 k; i4 `& F) Z; P
 the names of the two files compared; Y' u2 s8 d4 k9 \! G7 d# N2 j
d) Leave the program (exit)7 s# O/ \8 B: n
The ProgramCompare class: (Total maximum 20 marks available)
4 v$ ?5 U) ~, k9 i2. 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), R. W1 X. D9 Y' L: u0 y
a) provide an error message if the files are not found or there is a problem opening them+ t3 Z3 F4 C4 {# l9 ~# N
b) compare each line of code
& K: [) H+ p, e5 t; lc) print out the lines that are the same* {* Y* ~) W4 K
d) count the number of lines compared / lines the same9 y, h/ k4 x8 v) t( g q' P
The AuthorisedUsers class: (Total maximum 20 marks available)/ ^, T) g# ?, c
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)
8 t2 d3 a$ y6 _/ X$ V5 U& h3 A4. Provide methods to:) {# @8 S" P, o' m- t( F' W8 b
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
4 |, }1 g& ]/ ]3 w7 W ^# Xb) return the name of the authorised user
0 ^9 f$ P/ k8 _, n2 ?1 c5 Oc) return the name of the department of the authorised user
5 W m0 x' M% OIndividual Data (Maximum 20 marks available)
, `( t J- W8 B5. 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. ^* C+ |" w# ? S9 x
Documentation (Maximum 10 marks available)" i2 \& @# f2 b y
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.
/ K" W. n5 K S7 v( EBSA104 Business Programming – 2007: Assignment 2
: z& d. Q3 A( f; C2 g: [Page 3 of 5 |
|