|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
: h9 e4 T- ^. G* k* S hShanghai - 2007' N$ M5 ~+ p1 n. B' o
Assignment 2+ i& q* e) x# J3 D: S3 L1 O9 V- Y
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 `4 E9 G' b, B8 e
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.% Z5 W& m' F( j0 N( B' y5 d
The staff must be able to:1 T c$ E9 A- ~- j/ o1 N# c" A: h6 I
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
& f3 Q E8 X9 R7 L9 C# b1. 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.
% k1 ^+ e& ~5 D5 S& F The interface should provide a menu so that the staff can:% h2 C$ c8 V2 u d( z
a) Enter the names of the two Java program files to be compared
9 O, r" D% `' Q8 c For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
9 g0 |2 _9 ^9 D% C; U! P** 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).0 t# n9 }$ F/ y- R( L" {9 F
BSA104 Business Programming – 2007: Assignment 2
- n) {2 ?- ?# K1 v' c2 @Page 2 of 5
. `1 J6 `# Y% G4 p ^5 u6 Xb) Print out to the screen all the lines of code that are the same
2 W5 J9 K) C& i3 N0 F/ X; E/ { Include the name of the file and the line number of the code being printed for each of the two files1 I& w6 @6 v4 l7 t2 k |* ^
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
% p9 L& x8 _2 T0 D( C- g the name, username and department of the user
! t& n" h1 n" n/ { g/ i% ~ the statistics of the comparison3 v: g0 I2 P9 c. g) m
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
" e9 ^; u9 H8 h+ W& E the recommendation for further checking
# D2 M% [) z3 O- @% n3 B- 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
/ s9 k" ~* U7 a) E# a the names of the two files compared
; Y5 R9 m. O' }+ c& ^. V; ]. |) ~d) Leave the program (exit)
* c& r9 Q6 w' C, I& @The ProgramCompare class: (Total maximum 20 marks available)
8 D* |+ ~* g6 E& w) X/ X% P3 O2. 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), Y' V9 T9 j8 G3 Y4 c$ G
a) provide an error message if the files are not found or there is a problem opening them
7 @% j( |3 \7 t1 V) h6 k& Sb) compare each line of code& _# y& P6 _! o# F6 c) g8 c- G( S! f
c) print out the lines that are the same
1 s) M& Z3 m8 n, z# Md) count the number of lines compared / lines the same
; b" O9 q) x. |, D) J4 aThe AuthorisedUsers class: (Total maximum 20 marks available)
% A/ U- B; m1 B: s9 L0 F3. 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)$ v) l& z! g" D$ l i# ~# n, r
4. Provide methods to:- B/ p; W- ]2 V+ C' t
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 match4 m0 F, g( M; u1 l0 {1 s( F
b) return the name of the authorised user
7 m, D) Q. y/ w, f0 ?c) return the name of the department of the authorised user0 B1 K" A4 z3 v
Individual Data (Maximum 20 marks available). `2 g; I4 N" T( B ?. b+ v! V+ }
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.# Q/ {4 m5 j* a; [# B& x3 p# n8 P1 T
Documentation (Maximum 10 marks available)% o6 y1 V8 t& v& j
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.
" d {1 T+ f) a! wBSA104 Business Programming – 2007: Assignment 2! f; [% C* I. ^5 @9 T' V5 l
Page 3 of 5 |
|