|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
3 _# l" N4 D' u/ yShanghai - 2007, v1 l6 w1 S5 X. o) q% f& A2 J
Assignment 2
" k% y& ^8 ?0 Z G+ JDeadline 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 `% Y" M7 E2 P; g" F/ j1. 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.
" B l, M0 D3 P# yThe staff must be able to:
4 _8 @$ m5 ~9 Q; q9 v' ^4 m Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
& w" b P" D- y t2 L1. 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.5 `/ f) w5 b' T# U2 M2 f' H2 D
 The interface should provide a menu so that the staff can:# R( ^5 c' s! k3 t$ u" M
a) Enter the names of the two Java program files to be compared
M% F2 M: D8 Z( f& _ }3 |1 m For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
/ x1 y7 \* X5 @& m# Y Z$ Y; z** 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).& |( Z& P M2 |* }3 j: H
BSA104 Business Programming – 2007: Assignment 2
. Q5 J ~6 G7 o" \% B$ A& cPage 2 of 5. v0 r& B/ ?, G) s) m4 L, f/ X. w) H
b) Print out to the screen all the lines of code that are the same
5 ~0 R. a) h: m. Y; u6 [* ~ Include the name of the file and the line number of the code being printed for each of the two files0 z) F6 K7 k4 B- e! N
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
. C5 k& l! \) E6 c the name, username and department of the user
2 t8 I# h" ?: x* C L! M the statistics of the comparison+ B0 {7 o3 k8 P% m) H& b! p
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
7 s# {' ]/ i. e) i4 b2 C# G: c the recommendation for further checking5 z1 S P" x/ e) F: U. {" n: M! k8 {
- 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, _; b4 t+ Q1 X5 y4 t; H7 q the names of the two files compared: x9 ?# P5 Q8 t7 h3 ^6 Y( X$ w
d) Leave the program (exit)( x% ^; l1 d$ |
The ProgramCompare class: (Total maximum 20 marks available)9 _- `& J) `8 c' ], ]+ F
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)
) P" n$ Y Y/ J$ Pa) provide an error message if the files are not found or there is a problem opening them" w; {$ b/ q' a8 |
b) compare each line of code3 F `* G& z# q1 v" W+ D
c) print out the lines that are the same
) G( f( }" j6 O: r) Y% R4 A8 s# dd) count the number of lines compared / lines the same- m, N# e$ v9 X" e2 V% H% t1 e
The AuthorisedUsers class: (Total maximum 20 marks available)- ~# D8 }( I* V2 @1 z
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)
$ h6 T- ?9 ]! }. i4. Provide methods to:
. a7 |7 ~9 G( `2 H. j. a7 {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 match7 Q# ^1 t- f8 `1 F" c& A
b) return the name of the authorised user
) R- v9 _; |/ @5 M& Cc) return the name of the department of the authorised user
* I; O4 v3 U# f, @* w' c3 X# gIndividual Data (Maximum 20 marks available)
z* B! A5 N, L9 I* A% I5. 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.) \ N! K0 |( z. \: W/ S/ ]
Documentation (Maximum 10 marks available)9 L, B& L* d, _; @4 u% Y- W
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.
# _# I9 W) ?6 x* w+ T7 s( G `1 OBSA104 Business Programming – 2007: Assignment 2+ L5 a2 [! b5 Y8 z [0 n9 H8 c
Page 3 of 5 |
|