|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
# Y/ w( }+ g. X' T EShanghai - 2007& C& s; d4 ^7 a' }# i1 Q- i: Y1 h5 c9 S
Assignment 2) i- J0 V2 i- W. V$ M3 b! K
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)* B! q# G+ ?" T
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 {1 L1 X& Q/ e2 R( NThe staff must be able to:
; O8 z$ [0 q: V$ k' S+ z Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
4 e5 o3 L3 e# k( q; Q: ]/ [: x1. 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.; _4 v1 X5 @, F4 j" Y) d
 The interface should provide a menu so that the staff can:
5 `. R2 K j. z3 |" H) sa) Enter the names of the two Java program files to be compared
( x$ ^! t ~1 B T9 A( Q For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
( h* B/ U9 _$ I3 d** 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).
1 Y% v$ S, | @0 IBSA104 Business Programming – 2007: Assignment 2
$ r" M" D. s' IPage 2 of 5& n# @1 o. I9 P
b) Print out to the screen all the lines of code that are the same! p/ A8 Y- n5 @6 V
 Include the name of the file and the line number of the code being printed for each of the two files+ y% l# d. ]$ ~& `2 ]& u: ]
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared( R. v; m# {+ W& h) o" ?' F% n( y
 the name, username and department of the user
/ [) O/ p8 T1 h2 R. v4 z the statistics of the comparison
( u: C3 f! d( f2 G+ K- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different6 t+ C; h2 \8 K' S: `$ Y+ {
 the recommendation for further checking5 `* a d$ g7 |2 ^2 m$ 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
' _- i8 i- @6 w0 z the names of the two files compared
& x) F$ O/ t5 T2 {d) Leave the program (exit)
6 a' W9 G* ?2 p W- V5 ~ \; wThe ProgramCompare class: (Total maximum 20 marks available)
- [/ o6 b- y( U4 E2. 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)% G9 g( Y4 m5 F$ P7 @
a) provide an error message if the files are not found or there is a problem opening them
, }( I& S0 [+ u& h4 R0 K2 O& Z4 v1 F2 |b) compare each line of code
, l ^1 z& c9 J7 d% O6 Z9 Wc) print out the lines that are the same, M2 H* q# A3 h; M( A; n, M
d) count the number of lines compared / lines the same
! X; h% ~6 k; UThe AuthorisedUsers class: (Total maximum 20 marks available)
5 W5 u% ^8 I! }1 I0 b% {- d% N3. 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)6 A# f6 j, g s
4. Provide methods to: K. S& h& t$ u4 h4 z7 i
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
# e3 s, P, T! t& Ab) return the name of the authorised user: U7 E$ e* s0 B; c* Q& d
c) return the name of the department of the authorised user
4 x, n# d( k( PIndividual Data (Maximum 20 marks available)
* q" X% K* H% n: m9 z" }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.
' `- x* _$ d- _4 {6 LDocumentation (Maximum 10 marks available), `2 {! [& F& ^" T
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.- I* Z/ r( q& X6 x' `
BSA104 Business Programming – 2007: Assignment 2& D9 l% q' c9 i0 O
Page 3 of 5 |
|