|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
, Z$ W' f) T" Z9 Q) l& pShanghai - 2007
, o' i6 ^4 P' u5 kAssignment 2
* r2 e2 V1 i3 }* `0 [$ FDeadline 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)' N- r' }' x9 X/ v
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.1 G* U8 X1 N$ S' n* Z$ w
The staff must be able to:& O0 C2 J, I2 i; Q) X, ^, {
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
4 ~' V, s; r' a( A' k3 u2 i0 b$ g0 \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.
2 L6 G6 R9 o& u+ v a* V) M The interface should provide a menu so that the staff can:
+ I) q, D- T8 v. r7 P& w8 Q/ }a) Enter the names of the two Java program files to be compared
+ H7 G& R6 [ U) Y" }' i For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
5 D/ D! n) a: X8 L- y8 N9 h8 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).; }2 ]: L4 ]4 ?. }" \6 }
BSA104 Business Programming – 2007: Assignment 22 j/ {) O3 Y* R
Page 2 of 5- }# b1 {; T1 f, [4 S
b) Print out to the screen all the lines of code that are the same+ }! v2 ]2 y0 {3 M# p) s$ u5 k
 Include the name of the file and the line number of the code being printed for each of the two files
7 n" {5 j) N0 l1 ]2 B8 bc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared% v3 R9 |9 }8 J! U& F8 u" I
 the name, username and department of the user
2 o" g+ F" p& i the statistics of the comparison
7 _2 B, p( s% i6 z6 D8 @- ^- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
, }1 j3 a, `- v2 j1 o; k1 _ the recommendation for further checking
) a7 ?; g# p Q, O5 e- 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
$ {2 h' v) r$ E) `, Q1 J the names of the two files compared
& ~+ q- X' \3 o! Y$ {) Nd) Leave the program (exit)/ t7 d8 G% j9 {2 R$ z# N4 l9 |/ W
The ProgramCompare class: (Total maximum 20 marks available)
" ^3 H0 c) \# k* x, q5 L/ x# Q: p2. 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)) n" w6 u6 v7 P' |
a) provide an error message if the files are not found or there is a problem opening them
$ U- U1 o( r% `* wb) compare each line of code
) [% f+ W8 n# k9 `! oc) print out the lines that are the same
. X- C* A8 h5 a7 ?( m# e3 o: J Fd) count the number of lines compared / lines the same( b8 r7 O2 o0 o* n$ x4 G: S( m& n
The AuthorisedUsers class: (Total maximum 20 marks available)' w# l' x2 [* 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)2 ~0 j7 Y* {2 s% `
4. Provide methods to:9 C! m9 ~( H7 e+ K
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' c9 S# Y' c+ q
b) return the name of the authorised user o; e s9 f0 f; O
c) return the name of the department of the authorised user$ H( n6 x& T' m" h; f
Individual Data (Maximum 20 marks available)6 O! r" j4 x: S. u
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.+ p' i" T5 @. l7 D1 i" o& B
Documentation (Maximum 10 marks available)
% c8 j3 |! { ^! ~2 G6. 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.
Z! R' V1 ]. v: KBSA104 Business Programming – 2007: Assignment 2
7 e% q) A0 Z0 o* L& C- p3 gPage 3 of 5 |
|