|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
e% X- I0 `/ g hShanghai - 2007
4 k9 E; c9 O. R* f5 X4 `Assignment 2( G! Q3 v( \) R/ j9 k, h8 {
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)
5 c# J, @6 m6 k# W, ?. R6 j- W4 y1. 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.$ u+ m6 a1 ^+ D% @4 m
The staff must be able to:4 D& H- [/ J* M1 U+ ~# ~
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.+ j6 d# [7 Z" i1 Z! b
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.
4 k7 v! `' v: V' n$ u& s- B5 w. I The interface should provide a menu so that the staff can:3 N7 L) o" |& K2 S" J6 d+ C
a) Enter the names of the two Java program files to be compared
4 E1 w, c' h6 G' w2 b' H For this assignment, it will be assumed that the two Java program files are in the same folder as your program.2 t/ q' R; ]8 l! f* U
** 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).
- M( L) v) F* @' ]) d( I2 U' EBSA104 Business Programming – 2007: Assignment 2
; L3 [0 ?1 n U6 a6 uPage 2 of 5# J4 n: V1 p9 z* V8 p4 P; Z
b) Print out to the screen all the lines of code that are the same
3 q9 n( C5 |7 R; O5 S3 ?( {, F( e Include the name of the file and the line number of the code being printed for each of the two files
) ]% F5 w; J* F1 jc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
# _; e' T# W4 H the name, username and department of the user
/ d$ A/ P/ u: X3 [* [+ d the statistics of the comparison$ y0 j3 ]4 y+ ?9 j5 Q/ N7 X
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different( C# a9 n1 M; M! j
 the recommendation for further checking) y8 F, D: o: S
- 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, z) M5 o& h! p1 e/ H: W) @
 the names of the two files compared$ e4 n5 z a( `. J J+ h/ W1 h
d) Leave the program (exit)
& R- R: t$ l: |0 ]1 T$ QThe ProgramCompare class: (Total maximum 20 marks available)
0 _1 v1 E) `2 t7 G2. 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)- k" h0 }; [) b+ ]+ B5 ]9 y
a) provide an error message if the files are not found or there is a problem opening them
, t9 r6 o7 h3 C* ~7 ^" mb) compare each line of code
. L4 ^1 x* U1 t+ _8 h G7 nc) print out the lines that are the same0 H/ V1 d2 K1 o1 b$ T6 V9 I2 U
d) count the number of lines compared / lines the same
; ? }1 L/ |' TThe AuthorisedUsers class: (Total maximum 20 marks available)
( T- `2 k# R } a. ~1 q6 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)
/ l }8 G! X- U, _/ A+ z4. Provide methods to:
- [9 C. T: D& a2 Z9 @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
, R% s6 @( P! x# c6 ]! Z' Db) return the name of the authorised user7 f$ o2 e3 V/ X) ~2 l
c) return the name of the department of the authorised user# A1 l5 p9 v$ f7 p9 \9 g; m
Individual Data (Maximum 20 marks available)8 P, t$ |/ }4 Y9 {5 ~7 _
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' K0 M" V7 F' P" mDocumentation (Maximum 10 marks available)
+ Y# G# [+ s( P [5 f& d9 i7 o/ e6. 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.- a, e# d. |7 s" i0 B! C. L. X
BSA104 Business Programming – 2007: Assignment 2 I, v+ f( n' |4 o+ R
Page 3 of 5 |
|