|
|
|
汗,真是不知道怎么写,同学找了个哥哥,3个小时就搞定了,我编了3天,还有100多个错,可怕啊
) h; ~2 J8 [8 x; s2 y# z有没有高手帮我哦,周5就要交了,我的邮箱是[email protected],谢谢啦3 W4 G$ I' n; G6 q. O: g/ c: a
Requirements:
' V* y0 u9 Y* ]# L7 }4 BConsider the three Java Classes: Borrow, RepayCalc and RepayCalcMenu, available from the 6 J7 f! r% S. m! w# y, t* q
Assignment 2 page on Vista.
& Q5 n8 s& p1 T# N) i7 L+ V$ E / R7 n$ L" A: i4 e- U
You are required to perform the following tasks:
7 d6 W/ X. C* e, b 0 P7 Y. M5 D! O! c
The RepayCalcMenu class: (Total maximum 20 marks available)
" d+ V9 q8 F# r0 a) y) p" M+ K! ~; N- J: j/ T+ w
1. Provide a basic text-based interface to a Repayment Calculator for the Megalodon 2 F+ n- T* M! o# X( q$ s
Finance Company so that it can be used by the Megalodon staff members to * F5 p4 ~0 }6 j' G6 j
determine repayment options for their clients. & v) s: d; e/ B* a8 `
) [. ]- Q- I$ B The staff must be able to: 4 j9 ?' \9 a/ \& B
3 g9 e8 A* x: x* b* D g6 a( w7 @ * Log on to the ‘system’ using their user name and a Personal Identification
, u, m# e5 O( N$ u) x% L5 S: n Number (PIN), which a four digit number **. ( c0 g) o! G; a1 N" O5 _
5 Z. ~! P: ]* {3 R4 S * The user should not be able to use the ‘system’ until they have provided the
$ v, Q7 ?: K+ O' V9 } correct user name and PIN combination. You should give them a second or 1 _( z# y( u3 k* v( A2 k
third chance to get it right before shutting the ‘system’ down. % ]2 y$ I% w% R, {, ]
! _2 Q$ f- S4 u3 `9 F9 B
9 w* T7 I- W. j, Y. i( O 2 G) q# U' ] v1 b3 Z
** You must use the user names and passwords provided in your individual
. W- Q2 c+ r3 @' V& L% U9 G
- V% U; ]' H; Z5 Q ?8 E data available from the Assignment 2 page on Vista (see requirement 5 below). : s" D5 I V* I) U/ g; H: t
The user names and passwords should be included in your code, and the output
6 V! a) p' _4 m4 A0 x2 u% R; u% Z to the screen should prompt the user with the user names and passwords (for / g! J+ U& }! @0 p" M& S' G7 G5 _
3 P# A# R% Y$ [! H2 W" m8 L/ n
marking purposes). * H, ?& K% ?& i" V* q5 V
) Z. [! l# i# c1 a0 ]" Y5 S0 I6 \& V
) v8 ^& q S2 P: O0 L: x
! M) e, A" c8 R7 u1 U* The interface should provide a menu so that the staff can:
) S% a! [0 p' A _$ D0 k8 P- I# t" f: C7 Z% X1 F& v1 u
- Perform a Repayment calculation ! B$ L8 ]( Z# t- {2 ?$ R1 c
J) r6 |# F! [1 q# }: {) W
- Print out to the screen the Repayment details 7 e, u0 P( \$ K! U3 r4 H Y
- s5 F* T; \) g+ o/ h1 Y1 S6 l
- Change one, two, or all of the values for the current calculation
; O8 `/ z: G$ t M8 `& C2 F
0 V/ C! m5 i1 D% H2 m" I8 _7 ~ - Start a new calculation : G/ o- D% ]$ d6 {% M
3 [0 q( i4 \5 B0 l% L - Leave the program. ; o X2 b& [8 q$ J5 ]6 ]/ i
The RepayCalc class: (Total maximum 10 marks available) 6 ~1 _) P) z) l: d: o
8 H* q1 v6 X- ^! |
2. Provide a method to accept three input values from the user:
) w; q! e% l F- c6 H4 n$ w4 L- u+ M) ~0 L7 u
- the Amount to be Borrowed (to 2 decimal places, for example, 10550.00)
4 a* [* _( O0 o0 E1 @0 h0 f- H
2 S$ [$ V( x1 [: V* _1 j" l - the Annual Interest Rate (to 2 decimal places, for example, 9.75)
/ e4 q& v% q+ u8 G( n' D
9 y6 X1 @& B3 Q$ R - the Period of Repayment (in whole Years, that is, no fractions of a year) 6 ~: s& O3 m# Y% b; E
0 k& ~. }8 {1 y {8 O+ N0 Q6 K5 d- ^
3. Provide a method to print out to the screen the three input values (accepted in
9 d: N- S) O( T K8 v; W& D requirement 2), plus the repayment calculations: & s. [* E2 {3 V7 q
0 L( H0 n) } s0 ]5 } - the Weekly repayments
3 t5 s, e; {# D7 a% q4 U# k: t) r' m" v5 i1 ^- I G2 w
- the Total repayment amount (Amount borrowed + Interest)
$ s* `) K" a) y) ^+ Q( j S
- B6 K4 ^7 h% A+ `* Y - X- n" E! ]* ]5 y
2 O0 W: |; q8 ?% j
The Borrow class: (Total maximum 40 marks available) 4 i! S: R0 ^" [6 A( `
! s9 d6 L/ @1 J
4. Provide methods to perform the following tasks:
0 i# L- i3 ?0 G" t0 p
/ p, @5 p. E8 d5 t - to calculate the weekly repayments ***
- o: f9 W% R$ i# J/ {7 W; a2 y8 G" @
- to calculate the total repayment amount
9 V1 N! o& P% H
9 c, A' Y5 F) p! r x - to return the amount borrowed # `' M/ J+ u- f" y9 ~8 C
5 f6 y' n$ q1 v/ M" j - to return the borrowing period in years
0 q, _9 G8 H5 D- g1 j7 D; |, D+ {! o7 F1 j
- to return the borrowing period in weeks
: t+ Z( H5 \9 G8 J5 Q5 H( [' l8 F2 C$ N
- to return the annual interest rate
" ^6 f- N, m( U( H! `
8 q5 W7 b0 i2 T - to return the weekly repayments
6 a8 p g% m. J; }- H; n* `( J
, B. Z5 `/ D9 t6 A - to return the total repayment amount
: N& S' b0 X$ n& j, A' F
/ `+ L, E m, k q% W5 M - to reset the loan amount 8 O6 e% D9 m. V8 Y" ^
! {: V+ D8 P2 R, @! Y7 i. o - to reset the annual interest rate ; K% @) i3 x& E/ a) d; B% z8 g! g
% L0 p: x9 M: N. f* J8 H: u! _ - to reset the loan period (in years) & }7 O; D: E# w' c" L
k, Q# \3 B! W
. p7 h+ p/ c" c3 L/ }
% Q6 x M6 @6 E E, N% _9 }* A
! I: u) ? ]2 i2 | j6 l3 l" V$ [1 W
*** Use a simple interest calculation (not compound) formula, for example: % u! _0 [6 r O- S
& Z: \: b' G& b9 {
weeklyRepayment = (borrowedAmount * 1 + (annualInterestRate * ; U* [7 a5 l5 @5 X3 M0 A
numberOfYears )) / numberOfPayments;
* | J2 p. z* Y, {0 g& b0 E+ I
6 J5 @$ H4 r/ o, @6 G
" h. c4 F+ z% E; u0 j2 [
( j+ t) A5 ?, j( S; n4 G9 s2 B2 F+ U
( L! I* f1 Z1 S( J: u) {Individual Data (Maximum 10 marks available) : n7 v0 S. Y& v4 R' c I
* \( ~" d i& t5 U2 Q5 N3 Q
5. You will be given two Megalodon staff member user names and passwords, plus a set
, e8 J! v4 o) K6 p" U5 L of data for each staff member to use to calculate repayment details. You will need to 7 O2 ?2 }% p* N! ]/ i
log onto the BSA104 Assignment 2 page on Vista to generate your individual data
1 P q7 p D, \2 p! h [3 k and instructions for this requirement. You will need to use your University of
, [4 t$ N- r9 m5 a Tasmania (UTas) student number. # c- k& V# q$ V7 q6 }: s* }
- Q t m; m/ N# C, I9 F" B1 c. ]" K/ ~
Page 2 of 5 $ a1 S9 s2 K i1 ?( k$ O
1 Z8 O/ N: u' B5 bFor requirement 5 use the following data:
1 q& i2 b( I) |$ {' b: |% e, a4 M1 }0 n4 a3 Q# G( }8 {# i5 h1 t) i$ B
# Data Set 1:" C# E* u" t9 `0 W5 a
/ k2 a! G' h: j( a
User name: JordanM
* _) J" S M5 B4 H @Password: Ferrari; Q; V& z5 E$ a$ P9 x
Borrowed: $ 749.956 ~0 Z. D1 u( z# z) v/ E2 ~/ L
Interest: 15.0 %
( y5 r0 A# \6 P# Z$ \+ }2 Z+ kYears: 4
( D6 k1 c/ @/ I& O5 g
8 H, O: p9 N) q" a o2 F' `2 P3 F# Data Set 2:1 D3 ] n6 o; y% S; f5 x8 b8 K6 n
7 j5 n3 C; B0 r0 U; \+ d; SUser name: KimZ* X8 v6 K1 _% v5 \4 Z4 y
Password: DimSim
2 p1 E, O+ q7 W$ v1 O4 a- {" WBorrowed: $ 150500.25 b5 [9 J+ B1 b H6 |% |# ^
Interest: 5.5 %* |. N1 ]; W% m
Years: 7
& {+ p( y: j( J
3 x# q$ e5 R: x5 R[ 本帖最后由 wwwsnailcom 于 2006-5-24 02:15 AM 编辑 ] |
|