|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
m) g& \0 d M- i1 \% HShanghai - 2007
$ x9 r3 M- l, i7 z, H2 r( zAssignment 2, m6 g' B; H; ~; N$ p6 J
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)
: i w1 _/ x6 D- b, R1. 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.
4 I$ d% D+ |; i# M+ }/ IThe staff must be able to:
, Y# U# E% C }* f, g! \/ ]7 \' j Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
( N6 t( u) F4 m+ ?/ 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., T0 N @2 J9 |; }+ P
 The interface should provide a menu so that the staff can:
- K- i6 s0 m- t4 X9 Ea) Enter the names of the two Java program files to be compared
' F6 b( P4 B% D+ f0 V0 N- V: M For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
. r& S3 z4 c% J** 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).
4 @- c% V) l* r4 a$ q* \& @! ?BSA104 Business Programming – 2007: Assignment 2
) Z& D" K* u K+ C$ B9 h# |7 @, t$ ~Page 2 of 5# ^7 g; l( N% c2 |3 N' e; K1 o
b) Print out to the screen all the lines of code that are the same' ~6 A; h ~ V) d, }# ^
 Include the name of the file and the line number of the code being printed for each of the two files
/ c9 _- c- d) J' Cc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared( K2 @/ v9 q; ]/ A
 the name, username and department of the user
1 o, k$ C& b* z; u) L% V the statistics of the comparison
0 M( M8 E+ Z9 i( |) ] @- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different, e. a& z/ U& b& f. t7 S/ j* M+ v
 the recommendation for further checking2 K+ F8 |& k" v5 P M1 A+ ~' z
- 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
7 f- n: [9 V% }. Z4 v the names of the two files compared3 d" m6 X. f% y9 ~$ C
d) Leave the program (exit)
' S8 v+ J* k* l+ k8 OThe ProgramCompare class: (Total maximum 20 marks available)
9 g% p; B9 Q. @0 o3 x- Q4 e+ a2. 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)3 X# X: p8 E; }. |7 E- T) p. V+ b
a) provide an error message if the files are not found or there is a problem opening them" M1 |2 t4 B. w- ^
b) compare each line of code$ D/ w8 {6 K8 H
c) print out the lines that are the same
8 x0 u* P0 s/ ^& L* g Fd) count the number of lines compared / lines the same1 h W+ O' f7 d2 f k9 W- S' g
The AuthorisedUsers class: (Total maximum 20 marks available)
: V, s+ l! S7 V) b- ^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)
# a) L6 f8 A; T# U4. Provide methods to:
4 g9 W9 D4 C* I( E! x2 Ga) 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
+ i8 m$ k! b! r8 f. Sb) return the name of the authorised user
/ M0 L. M* [! F, G. t# p; _" bc) return the name of the department of the authorised user' n% D0 @/ {) I& j, p' ~
Individual Data (Maximum 20 marks available)/ N6 p" ]$ }3 K3 N$ Y+ T) c$ l& @
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.
' C5 _ t$ G2 X6 t+ I$ G% B( DDocumentation (Maximum 10 marks available)8 j3 t/ ?: k. M, z$ J/ I
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.+ q$ N: V% R" |6 X2 e& `: t0 ~
BSA104 Business Programming – 2007: Assignment 2
- Q( r( y- Q' |7 KPage 3 of 5 |
|