|
汗,真是不知道怎么写,同学找了个哥哥,3个小时就搞定了,我编了3天,还有100多个错,可怕啊( ]7 @/ H7 Q* `3 L2 @" c
有没有高手帮我哦,周5就要交了,我的邮箱是[email protected],谢谢啦+ C: I/ {3 m( B. R4 G; A- p, ^
Requirements: . j4 s! c$ E* R$ V3 v
Consider the three Java Classes: Borrow, RepayCalc and RepayCalcMenu, available from the
& |# o) a3 L) U/ V6 I5 hAssignment 2 page on Vista.
$ t8 ]# ^* N% { ~ 9 N, ]. e1 R6 R# r
You are required to perform the following tasks: 2 X8 D# t' }+ a! Z
) @( a" E9 G& \- w& y8 O, _& ]The RepayCalcMenu class: (Total maximum 20 marks available)
# a, K) A U2 Q( D3 W p' ~& d2 g" m8 f# n m
1. Provide a basic text-based interface to a Repayment Calculator for the Megalodon
V) m8 ?/ g$ {# T0 e9 S1 N2 S, U Finance Company so that it can be used by the Megalodon staff members to 7 T) [/ {/ i" N/ H+ B
determine repayment options for their clients.
( R6 |" K' E( g( O: D' ?; d
; w, B) a+ c- y: t( P The staff must be able to: 2 S+ ?7 E* `- ~, B+ U
0 D1 y0 |9 J$ A; u; n * Log on to the ‘system’ using their user name and a Personal Identification
3 T Y, u p2 L: _ Number (PIN), which a four digit number **. 8 L5 n. V/ l% p c4 D( i
! u) u" l( e6 G4 b! Z5 e
* The user should not be able to use the ‘system’ until they have provided the * |& A* Q" `5 A3 G- y3 Z( l8 \1 E u8 N
correct user name and PIN combination. You should give them a second or 1 m0 E2 ~) \% h- [- x- l* X
third chance to get it right before shutting the ‘system’ down. - A9 s6 E0 R9 z+ N B( C6 U: i g6 l
( q8 _9 J4 M6 M) m, s
5 Z K+ g, f6 v/ w6 B : E5 h2 B4 k6 j) U
** You must use the user names and passwords provided in your individual " t7 W1 ^7 a' H
9 V* a8 v3 i$ V: G data available from the Assignment 2 page on Vista (see requirement 5 below). B$ F' T' [4 P1 o/ ?( L+ ]! h* ?
The user names and passwords should be included in your code, and the output
4 r2 x( B3 _" c8 ]+ ? V6 b( O to the screen should prompt the user with the user names and passwords (for , H D% N+ F% E( [% {3 W, p
7 `. N3 N; D$ n6 F: Y, T marking purposes).
- p4 F& j0 o1 o# p# F+ y% b; Q" ?! R6 }8 {, g& Z$ ]9 S) M
- c4 L" J, [: F; h) L) \% q2 D
5 {3 k+ S; {2 G7 V+ s" D* The interface should provide a menu so that the staff can: & ~( q' O& B; I6 D$ ?2 S- o8 k; V
4 k, } V! Z; e4 i, Z
- Perform a Repayment calculation
) [+ F& g0 M# Z0 _) \
6 k/ [6 ~" H( m. x. c4 h* m - Print out to the screen the Repayment details
' F6 g" x; j+ ]( b3 M8 Y9 {: d( E- ~: k& Z5 b& ]8 p
- Change one, two, or all of the values for the current calculation
& x; G* ^& H: Q# u
! e' S4 B0 _# {% e - Start a new calculation 2 ~4 @6 R4 ~: H% V1 N
% s* Z- \2 ~* n, ~% u4 L - Leave the program. ) G H" l9 D$ `$ S0 o0 F7 j
The RepayCalc class: (Total maximum 10 marks available) % ?; I! e5 ~1 a! j7 R8 k
0 D+ [) s# a8 b" Y- {; p
2. Provide a method to accept three input values from the user:
: @1 C' X- I2 \5 g I9 i, P5 x
: H- q. @) U5 h+ S* K, Y; A+ n - the Amount to be Borrowed (to 2 decimal places, for example, 10550.00) + m* g: N% {0 k& m. {; y
8 T: w. N/ o) a5 y8 q/ }7 q
- the Annual Interest Rate (to 2 decimal places, for example, 9.75) / V& |4 V& d. }% g0 L3 }
- y, h8 V+ A, ^. Z. K+ Q1 C - the Period of Repayment (in whole Years, that is, no fractions of a year) 1 {* C7 c5 K8 R. `
- s/ w$ \- e R0 L. O g
3. Provide a method to print out to the screen the three input values (accepted in
" f- n8 z2 W: q7 O% w8 f4 O requirement 2), plus the repayment calculations:
. L7 G& R2 {: i; @- a6 c! K \
6 _/ M- v5 O2 w% z - the Weekly repayments
: t' \0 O5 r+ `9 R0 l+ [( W6 P. Y
- the Total repayment amount (Amount borrowed + Interest)
4 W' n3 A8 u- m) A0 h' i0 l/ I
& c* n ^: [" P 8 W" s, C8 K9 m, h0 y$ D4 u
; ^ [" {4 \. I
The Borrow class: (Total maximum 40 marks available)
* t3 R0 w$ k# P; u9 }% \/ w1 D1 z/ X- |& ~% R1 F2 Y8 z
4. Provide methods to perform the following tasks: : p/ I) a6 r( K3 K! L( H- a
# l& N# S' B' M- J5 V& c2 N2 v1 v
- to calculate the weekly repayments ***
2 s& Z5 X; I9 |& z- {3 g! Q4 a4 e+ |2 s' f- q* q# k) h
- to calculate the total repayment amount
2 C7 T+ P' L7 b1 c, o
, W) u4 k9 n' X6 f5 q" ]( A( a - to return the amount borrowed : v; [/ U8 N! r' \
- |; P) l- _5 M- H% b* R7 u - to return the borrowing period in years
. P7 V5 Z( y; p0 U
$ Q' { _: N/ m: a6 `4 R - to return the borrowing period in weeks ) p4 i% M# j: v
8 M7 s/ _) r6 j( i! [
- to return the annual interest rate 3 p4 p0 T" p0 g
2 j6 x3 M! _- i" o. c - to return the weekly repayments ! j9 }' V |+ o! h& v5 {
+ [8 J, f1 ~, n7 f! J1 a - to return the total repayment amount % [5 Q( |: a3 U. ^
# ^+ V5 _+ w1 o% ^# h - to reset the loan amount
7 [' M0 W {7 S) W4 ]0 s5 M- S7 \) B( L& s" W2 l
- to reset the annual interest rate 6 d. Q4 z1 C' g+ j& N! {# i
0 t, P, t' L/ T8 A, G
- to reset the loan period (in years) & Q) |: d& H% [# {3 C) z) ]$ k8 k
$ |+ p7 g' ~9 E1 X
7 k$ h3 R0 r4 h+ \8 `
7 J7 T. ~) P& y F- ~' d9 t8 S2 k / n) h0 i; I) x0 P9 V* |
# j. f( F! M$ _! ~* a *** Use a simple interest calculation (not compound) formula, for example: # {& J* d& i2 ~5 n0 {
1 l- g( |4 y5 z6 k1 m weeklyRepayment = (borrowedAmount * 1 + (annualInterestRate *
0 c: q3 O* ?& K F' N9 N" E numberOfYears )) / numberOfPayments;
' K; E8 J) m) t0 x+ H' s
( o& P6 D, J v, T
8 V( B* _! `( j% i" }& Q! ]* J3 f1 T! u# Y9 f! m
& p1 B! v, m" J0 |4 [' ]0 N
2 G+ Y! B {% h% `# ^/ ZIndividual Data (Maximum 10 marks available) 9 S. t7 q* R8 \. T. F8 r3 N( R
- x7 D1 p6 @# J4 j* ~6 ^; Q8 _
5. You will be given two Megalodon staff member user names and passwords, plus a set
" y4 x2 H( g; t3 f# x of data for each staff member to use to calculate repayment details. You will need to
# r- X! F u- Q3 g0 h7 c log onto the BSA104 Assignment 2 page on Vista to generate your individual data
9 D9 D. `& P% l1 v1 }6 P9 }- T and instructions for this requirement. You will need to use your University of
x% T6 ]: ^" k6 ^ Tasmania (UTas) student number.
* @" U6 V* ?) [$ `
* B6 c! G; Z, ]' S; i7 X
3 k, y& _! X! L' P Page 2 of 5
! a# ]5 n( ?! I! {0 T' J3 D
7 h) P3 x$ i! ?9 R. _For requirement 5 use the following data:
% P X# M7 x4 n" b. c+ w G; C
9 d. f. l. I# m5 \! i( u) |# Data Set 1:
$ u5 W$ ^* b' O6 t4 h. S
0 r4 r" y' P$ t. BUser name: JordanM
, O* T: l7 {1 b8 FPassword: Ferrari
3 C! z7 W" I) s# p+ q4 MBorrowed: $ 749.95* E& [9 Q3 j4 D
Interest: 15.0 %6 H+ c- T+ ^- M3 D( p% H' p# E
Years: 4
1 s9 I: g$ n6 M0 O1 {1 O3 b$ c9 d3 U1 X9 L* \
# Data Set 2:
/ t, u/ N2 M) [' q' [
U9 n9 B1 b$ S0 R6 u. IUser name: KimZ
. X+ U) t* b' r9 b; \1 F' xPassword: DimSim7 x& K- W. k2 s4 a% j
Borrowed: $ 150500.25 a j+ m) U( j) w' @' r1 a" n& z/ M' K
Interest: 5.5 %
3 ?. w. o2 V" C$ P# M6 UYears: 7$ W( G4 g$ J6 o& Z# Y6 L
% x x8 l- v8 n# G0 e7 a3 j[ 本帖最后由 wwwsnailcom 于 2006-5-24 02:15 AM 编辑 ] |
|