|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
- a+ h- L2 J# Y, X2 T% _Shanghai - 2007
0 p7 J2 H% K) @+ mAssignment 23 K& V9 x" J% k/ I
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)
F0 r7 b7 ^0 E9 |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.
: ~* r1 y' F! f& P; K4 oThe staff must be able to:
5 y }5 U, o2 z& ? P Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
; [8 e( m* G; F" T1. 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.% J! d/ I0 `2 w1 W) i9 F
 The interface should provide a menu so that the staff can:
) u* Y! ^! s, a5 G0 M' X& I( ma) Enter the names of the two Java program files to be compared& h4 m2 e% x6 }! U
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.% i/ U* w$ C' u4 s1 c4 C% \
** 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).
9 F" E, ]0 Y5 ]BSA104 Business Programming – 2007: Assignment 2
2 B9 N1 F1 s! b" o1 @Page 2 of 5; q0 P1 B1 ?+ H9 p+ l
b) Print out to the screen all the lines of code that are the same/ P$ B' k2 S1 H; T5 s
 Include the name of the file and the line number of the code being printed for each of the two files0 J2 }! [, [% U% G% j
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
, ^9 D. v" d, X4 A6 |; m2 q& y& I the name, username and department of the user
( M% i. c7 t; l* E% A the statistics of the comparison$ x/ A* E4 X* f. B1 X0 \8 o8 |
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
* H' I% C7 ]; G0 V0 I the recommendation for further checking, b Z3 y6 ~6 q f% F
- 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* N. K: m( o( i8 [- N: G) ^5 i _
 the names of the two files compared
# d9 u' [' {0 B9 ^% e0 Rd) Leave the program (exit)+ M! B B1 m y: C# m2 R7 q* \3 N
The ProgramCompare class: (Total maximum 20 marks available). f$ r' w) |9 i3 H* S
2. 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)6 d# Z. \) a, [# @) Q4 c5 o7 E% T2 i
a) provide an error message if the files are not found or there is a problem opening them2 }" x* k$ Z6 D9 l9 v8 H' d" F5 o
b) compare each line of code
! z5 I7 j, }/ Z9 U( @* ic) print out the lines that are the same
$ d7 g2 p$ W; q! K4 kd) count the number of lines compared / lines the same7 e+ C/ t& [5 R
The AuthorisedUsers class: (Total maximum 20 marks available) q* f! U1 s7 Z8 \, w
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)" a2 |9 _( h: Y+ ~$ q; k& ~
4. Provide methods to:
& a# p' Y$ e$ k9 S7 Z1 Ca) compare the stored username and PIN with the one entered by the user - return a value that indicates whether they match or do not match7 U9 l! o8 r' d
b) return the name of the authorised user
5 e0 @0 c1 X" f8 d! oc) return the name of the department of the authorised user
) A/ U2 b/ c/ sIndividual Data (Maximum 20 marks available)
" \( |% v# n$ {1 n5. 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.2 g7 d) |8 _' Q8 H8 a" S! e9 [
Documentation (Maximum 10 marks available)
/ O) z J; `. U0 f: b4 S7 S+ `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.
* S8 d6 P/ ]& g+ ]" t+ J7 rBSA104 Business Programming – 2007: Assignment 2
, l' S, b8 p8 I$ K+ o6 o8 j+ bPage 3 of 5 |
|