|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming2 t0 G) m, H" S, I
Shanghai - 2007
4 k9 d0 k6 u# ?" Q+ w yAssignment 2
1 k. y h( R4 k2 K% L2 \4 @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)3 z: N# y* _' H& C, N/ P' ?+ c
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.
8 \# W! W% S7 x0 c# t! EThe staff must be able to:# n& _5 e/ |' g2 Z
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **. h* U5 w0 \% ~" i* O
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.6 k; m' v1 _. x' z7 l2 m. ~8 g8 W
 The interface should provide a menu so that the staff can:! S3 K& @8 W$ }4 p; B) D
a) Enter the names of the two Java program files to be compared+ s( R$ X' W+ m7 A# E1 H
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.. x1 |' h) E$ c! d& 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).
/ }, W, C, H# x$ {2 }BSA104 Business Programming – 2007: Assignment 2% E( m1 \; X* [4 j5 o; V/ g; j6 {
Page 2 of 51 @; b5 H5 p! R4 o2 ~# T! L& B& a0 n
b) Print out to the screen all the lines of code that are the same
4 o3 C, S) y1 x# M9 G+ u Include the name of the file and the line number of the code being printed for each of the two files. x4 L+ N8 |0 C+ O5 N( @, O$ W) Z
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared$ U4 G# R2 Z$ w# ^
 the name, username and department of the user
* @! ~2 n2 ]0 H' Q: F# a the statistics of the comparison& {3 ^, z& G# i$ L5 t
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
7 x4 h( l! n! J! ]5 U3 T; M the recommendation for further checking7 n* j. C$ W$ i6 g4 \: D7 ?
- 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 closely6 |0 j Y* |; R) A7 Y9 N( F
 the names of the two files compared+ N! x' ?; P9 q1 b
d) Leave the program (exit), B; t2 t. ^) @7 X4 m1 T& y
The ProgramCompare class: (Total maximum 20 marks available)- ]& p H4 q! {6 f) j. @' w' ?
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)
$ `' B9 F6 @' H+ t5 p9 M; t- Q- da) provide an error message if the files are not found or there is a problem opening them
% S n5 X# k5 J1 ]b) compare each line of code) h2 L f" }) q) p2 s
c) print out the lines that are the same m- p2 L3 }6 k' h/ Y
d) count the number of lines compared / lines the same
$ |/ r5 g9 y- C( C6 [# R4 XThe AuthorisedUsers class: (Total maximum 20 marks available)" f; k7 c9 X' o' A
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)
( M n. N( }8 g4. Provide methods to:
: H6 K5 w5 q1 Q. A0 N7 M0 C4 C. Xa) 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( J9 A+ `) S! j. ?7 \& i& F
b) return the name of the authorised user
2 b: }# J5 L$ |5 n! m- _c) return the name of the department of the authorised user
, a j3 P+ u& m3 d2 C6 `8 vIndividual Data (Maximum 20 marks available)+ E1 B) Y( |" S5 U+ u
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.' l4 j1 a, |) @6 V0 n
Documentation (Maximum 10 marks available), c9 A) ?8 B! u
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.3 p% @2 g# A& S) W2 E# k) A, k
BSA104 Business Programming – 2007: Assignment 2. r8 z6 E' [2 @, w5 N
Page 3 of 5 |
|