|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
1 `5 W; G: W* b& v, o2 GShanghai - 2007$ o( h$ E8 F! T- B1 E! h5 S9 C
Assignment 2
! x. b4 U1 M; HDeadline 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)" z* [3 a- |# _: ^6 y
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.6 d- A7 q* Y1 u! G+ \1 [5 A* v
The staff must be able to:
" V3 F3 b2 y K Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.! d" I8 L2 R9 M5 h
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.9 G2 y' V! ~; z
 The interface should provide a menu so that the staff can:
+ u* z2 y: v N' M2 Va) Enter the names of the two Java program files to be compared
" Y7 g# g+ o2 {' y9 N6 D. ~ For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
* q( K9 W' \/ A7 \** 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).: d: }9 J# s, R8 k7 d7 M/ R% h# C
BSA104 Business Programming – 2007: Assignment 2
" I6 Z- p) m- c8 @0 Y. b- m. nPage 2 of 5
/ _/ Q8 E2 w- _ N0 t; m& s4 _. Cb) Print out to the screen all the lines of code that are the same
0 I; N7 Z3 h; ] Include the name of the file and the line number of the code being printed for each of the two files6 k' G' t k ]; X+ l
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
$ ~2 H6 s3 G7 K- l+ q3 P; R the name, username and department of the user7 S {9 p& J6 q A
 the statistics of the comparison. c/ S) N* o5 V+ H9 U2 B" q5 B
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different8 a v c% J; V6 |8 X; m
 the recommendation for further checking8 L# I& ]# I8 b5 L+ t# T' K- u
- 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
0 [6 m; {* b8 M3 H+ `+ h# |: |& K the names of the two files compared% ?( O* ?5 ^6 H3 N
d) Leave the program (exit)
$ @2 R! R# q5 z( F& _The ProgramCompare class: (Total maximum 20 marks available). d6 [! M. g6 D m* A1 z/ K1 `
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)0 U" U3 [; \0 [2 {8 e5 F. v
a) provide an error message if the files are not found or there is a problem opening them
; W0 {5 W0 \& [; @3 A3 C1 @b) compare each line of code
$ E0 H7 V$ Z/ z- N' bc) print out the lines that are the same
. ?# i# j9 j& {6 Q3 J+ `d) count the number of lines compared / lines the same: r1 F+ X4 N# s6 ^
The AuthorisedUsers class: (Total maximum 20 marks available)
. v5 S& [8 x4 X3. 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): u6 ]8 ]; Q7 e* E: f; {0 L
4. Provide methods to:
6 b" T% B3 s! H% Q; Ja) 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
! O( t: I1 b* Q$ G2 J. |b) return the name of the authorised user) k2 R; t' I) L, [* l/ j
c) return the name of the department of the authorised user3 X" o$ I1 s% a0 w& J5 L7 N
Individual Data (Maximum 20 marks available)0 _- n6 A1 L4 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.
, k: p& U3 d b# I( ~# `Documentation (Maximum 10 marks available)
4 r3 G6 o* ~% `3 D% @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.9 F1 K9 U: ?0 J B9 M
BSA104 Business Programming – 2007: Assignment 2
8 W2 y" c e$ NPage 3 of 5 |
|