|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
2 \( s% k- v$ u- M! Q3 W+ qShanghai - 2007
" K" a- |+ D' ^. gAssignment 2% k$ U: W+ B4 Z
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)7 U8 n3 M3 R) Q7 q/ B
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.0 J& p$ I4 Z+ B& p
The staff must be able to:/ J: |9 O; w! g3 m+ O
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.6 }/ Z# q3 l$ w) m; n
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.
+ Q8 c6 E- V$ A: e4 w6 c The interface should provide a menu so that the staff can:
; S; l5 ^; _" aa) Enter the names of the two Java program files to be compared* B# f! ^" ?5 L: B- f* u# E. k
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.0 V6 n- D" y' O `5 O& Y+ y
** 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).
. {. K8 q; G* f& v! M/ xBSA104 Business Programming – 2007: Assignment 21 k2 ~0 b& v/ C% a# c
Page 2 of 5
7 x& V- _1 d5 }b) Print out to the screen all the lines of code that are the same1 x+ r: n, T4 g5 h* m* ~# p" X
 Include the name of the file and the line number of the code being printed for each of the two files+ Q$ l+ e) ~. f3 Y
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared: R# A6 X) o& m+ T+ A) |
 the name, username and department of the user0 F$ Y) a% ^1 q9 B: `
 the statistics of the comparison8 K+ |7 T/ l0 ?$ V' Z1 x
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
: { d1 [. h, u/ |( L the recommendation for further checking
. ?+ W1 J9 g+ e7 c- 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" r, u2 K" t! G$ B
 the names of the two files compared. K& b) w1 }: I$ K- z
d) Leave the program (exit)$ p3 T. o5 v. o+ M
The ProgramCompare class: (Total maximum 20 marks available)
! k. Y z% a8 Y9 `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)
- o% v) ^' `5 f- Oa) provide an error message if the files are not found or there is a problem opening them8 R) j! n/ R6 _$ B
b) compare each line of code
! v) P# O6 L+ Bc) print out the lines that are the same
! h8 d# R9 Y( r% {; Xd) count the number of lines compared / lines the same6 S$ R9 g3 g4 m. T+ A1 C) g
The AuthorisedUsers class: (Total maximum 20 marks available)/ b5 y# c$ K- F: Y9 N$ V" u
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), N! r+ f4 s: c: } q$ Z9 q# y! d
4. Provide methods to:* b* L0 K4 N) h+ ?8 e
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
+ | y Z( ~3 h8 {9 ]b) return the name of the authorised user* z6 m i* A6 p2 ~1 _; W+ E* [, t
c) return the name of the department of the authorised user/ n3 l: _7 w- N4 X0 G- {- M3 r% L/ l
Individual Data (Maximum 20 marks available)
6 q) k7 J m0 |0 G5 M- 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.
: ~3 w+ q5 B* c; I8 [: ?$ JDocumentation (Maximum 10 marks available)
5 \& a% t- d+ U2 v6. 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 q7 I! q, D! H: l; {5 OBSA104 Business Programming – 2007: Assignment 2
9 Z; `0 f/ ]. N3 Q8 \Page 3 of 5 |
|