|
|
|
汗,真是不知道怎么写,同学找了个哥哥,3个小时就搞定了,我编了3天,还有100多个错,可怕啊' X7 L u7 o" W( w4 d- D* b
有没有高手帮我哦,周5就要交了,我的邮箱是[email protected],谢谢啦' g" R; b4 ? x! `, k
Requirements:
; h' _9 p* `& b4 G. GConsider the three Java Classes: Borrow, RepayCalc and RepayCalcMenu, available from the $ e; M& o& Y& p+ Q& S
Assignment 2 page on Vista.
4 q' s) T1 k3 b- J# s3 p6 p7 w9 o( K
& F) g" C# Q9 |: IYou are required to perform the following tasks: 3 x/ c9 u; K1 _+ g- V
5 I, _1 j! T6 s* [/ A7 G
The RepayCalcMenu class: (Total maximum 20 marks available) 1 k) `0 H+ G, |
; P, Q, {; l- y% b/ G C
1. Provide a basic text-based interface to a Repayment Calculator for the Megalodon
; Q' n/ |6 I* y Finance Company so that it can be used by the Megalodon staff members to
% y, Y9 C+ B- L$ D' m determine repayment options for their clients. # y# \& I' u) k# Q! {5 ~" L3 A8 c& Z
2 K% N5 f/ Z' W9 \, E2 ^
The staff must be able to: # X2 `4 c) c; V! }6 `& ?. t, N8 v5 u
( K8 N' L1 \( H) d" b1 s
* Log on to the ‘system’ using their user name and a Personal Identification - i- R/ N5 w+ p# N
Number (PIN), which a four digit number **. 6 |: `* D$ |7 o# x
% A, V! e- ~) J' \5 n0 d+ \ * The user should not be able to use the ‘system’ until they have provided the 1 F# P. T2 A2 H% V
correct user name and PIN combination. You should give them a second or
. B6 Z" F# L* y8 H third chance to get it right before shutting the ‘system’ down.
, ]* J" Z" S7 p( m3 R/ U) j" M" ~7 l3 V; \0 X, I
5 M; X) [+ U) G1 J
7 c7 q& M2 Y. G* X0 `$ b
** You must use the user names and passwords provided in your individual : v$ e; n% P6 O; i2 D# ]
5 q2 B$ Q* }" |: ]8 V data available from the Assignment 2 page on Vista (see requirement 5 below). 7 l' N" M0 z0 z, e. q7 s
The user names and passwords should be included in your code, and the output 7 Z" `; \- M- i( z% j! h+ Q( k
to the screen should prompt the user with the user names and passwords (for 3 @5 e D2 I( Y5 Q! k/ e
" @8 C6 z" O) X7 @
marking purposes). . C3 P' a7 n C3 _
! _% }- w U- V4 q+ g 3 s1 ~3 d8 L5 i) H" D K
% a+ {/ p# e! r* W1 y* The interface should provide a menu so that the staff can:
+ C' f+ c: \' T& M& S" I; d( J; X2 X- ^* t* u
- Perform a Repayment calculation 6 K5 ^ b* n: u
w& W! ^' _4 J - Print out to the screen the Repayment details
1 K; l* k Y) m$ m+ t8 J
4 a& `" _4 |4 S/ K - Change one, two, or all of the values for the current calculation 7 t: @$ C) z& e: M# ]
t2 t' l( Y# @! O - Start a new calculation
- } K3 t4 q; e9 o
# S% x/ Q L6 u" K9 o' S - Leave the program. 0 n! h6 `6 @' V/ p$ j4 D
The RepayCalc class: (Total maximum 10 marks available)
V! a0 k* L2 Z5 G0 z4 y% {2 I; c0 |) C
2. Provide a method to accept three input values from the user:
: y1 k% F' L7 i) k! ]0 @9 M, B3 i6 _2 x' E
- the Amount to be Borrowed (to 2 decimal places, for example, 10550.00)
) M7 L$ N0 \6 P* e5 V, N) R+ T% R; G7 {. [1 B' K: Y+ f6 h
- the Annual Interest Rate (to 2 decimal places, for example, 9.75)
7 L: k; y8 c- _: h ?% b' A1 V/ k/ V) s, d4 M; m9 A4 O
- the Period of Repayment (in whole Years, that is, no fractions of a year)
% {6 Y: w a8 s, P9 D: z
0 w; W! M+ W7 Q 3. Provide a method to print out to the screen the three input values (accepted in
/ L: j" ]; U/ Y requirement 2), plus the repayment calculations:
/ \3 H1 F: K% w9 q8 I
! P9 c' e5 F: X; U/ h$ ? - the Weekly repayments $ [( R- H+ R0 d+ V
- M, q- g/ h+ u
- the Total repayment amount (Amount borrowed + Interest) % I) v9 e& C+ q& w5 o# Y- Y
) v) _3 B# d' D* i1 H4 |/ c
. d& ~) ~; ^' z) v
1 z' S2 F8 K7 A% ~) DThe Borrow class: (Total maximum 40 marks available) # \- f( {% z$ F- E
9 x" l& b4 Z# G3 C9 H 4. Provide methods to perform the following tasks:
9 I% h8 ~: \5 V% S4 C2 d6 {: L. @+ l8 d- @, X* z
- to calculate the weekly repayments *** 6 s1 i: D- y3 Z0 l. R- z
) ^+ L4 h8 Y6 }! c% [/ u: Y
- to calculate the total repayment amount ; K. R9 P# L# e
5 Q; O' R) i- v1 k& o& j - to return the amount borrowed
2 S% b+ v: ^% M8 @9 W- R j
$ o( R8 [5 M% c$ y6 u8 q - to return the borrowing period in years 7 E: E$ `- k7 a+ Y: |
% _" B" L' D: ` `+ ]' h
- to return the borrowing period in weeks 3 @! D; E5 ~4 j) }: ~* a P/ M
4 E+ y- |# ~; E; `0 g. f# S - to return the annual interest rate
6 B4 X/ W- {8 A, _( D7 `
2 A+ J! z6 p+ O s - to return the weekly repayments
" ?; y( r3 O2 d z5 r$ E
0 ?( q+ i7 y4 H4 B2 m& l/ ~0 u - to return the total repayment amount ; G) y7 a. _3 i; p
* Y* F7 W4 f- ~
- to reset the loan amount 1 j' ?8 t8 c% O7 K- U
7 X! L+ K% ]: P2 }* i - to reset the annual interest rate 2 p+ R% `0 F# c0 B
# x, A8 M0 \/ j
- to reset the loan period (in years) $ F0 r; E% j! S
! J" _. ]4 T" n' M
) Z8 z1 i. U2 ^0 L) p, p6 d6 y; V7 n7 u6 W9 ?; F- `
3 y W; O. j' }# ^; P
4 Z3 f- L; [* w; a3 H/ P *** Use a simple interest calculation (not compound) formula, for example:
6 z/ q1 l" ~: m% F3 Z ( i: B1 |5 t! \7 `+ j+ `8 _
weeklyRepayment = (borrowedAmount * 1 + (annualInterestRate * 2 R* e0 W3 z! D8 q- H* P, }$ f
numberOfYears )) / numberOfPayments;
) ~6 r; } }" ^9 w% W, _& N/ |' E- Z" ]. K- K& z* X+ M
( U" z# _/ }$ n4 A: s# Y& E! O! h# j) L2 |4 `% D7 k, {
X2 t& T; d0 H" y) C% j K3 N2 J' W: T
Individual Data (Maximum 10 marks available)
; R, f2 `! M6 C+ _5 z# ]- x
) K$ f9 D; v( q5 g; ~ 5. You will be given two Megalodon staff member user names and passwords, plus a set
" h5 `) _2 d8 h9 M) r- P of data for each staff member to use to calculate repayment details. You will need to 5 s: u8 E) }+ G& g- x5 I
log onto the BSA104 Assignment 2 page on Vista to generate your individual data
# ?( H$ `& s8 E+ U0 g3 P* A and instructions for this requirement. You will need to use your University of
& v; S. y2 t3 @& B' L) B1 a8 l Tasmania (UTas) student number.
8 K% m4 n' N# V7 }7 |2 S 8 J( l0 O6 ]! B7 c# F# u# y+ G3 T
. ~ `- N" A1 j1 u6 `8 R* N
Page 2 of 5 5 E4 p$ G- i" y: E% _
6 I6 V! X! s8 x4 Q4 X
For requirement 5 use the following data:
9 P& P- F$ }7 Q8 F$ J r
* w1 S9 p7 L& o$ N4 D. B/ w# Data Set 1:
3 s9 D3 ?3 `0 G% v8 |
: `8 N0 P: F( v9 |8 ~User name: JordanM5 X% W4 |6 R M7 ]' L+ G8 _$ P" X
Password: Ferrari' g% `+ ]( W* S! f
Borrowed: $ 749.95
! d( [- h( C1 V& H. ^1 JInterest: 15.0 %3 n& ^7 Q, z% U, y/ H
Years: 4
: n: g. }, V. n3 f" n( |! F1 B" U2 d( ?
# Data Set 2:% M$ @. k. u Z& l
2 n- Z+ i& }' `) m/ I( ^
User name: KimZ/ O+ ~+ k3 f& C" g5 _2 [! u+ Z' y) O
Password: DimSim
# l2 X1 ^- a1 P/ w$ s" z4 X- r* A* ?+ qBorrowed: $ 150500.25$ C) m' w- {( }1 C& o" f8 Z' k
Interest: 5.5 %4 P7 q# V; Q+ j3 g
Years: 7
! B, A9 s4 {& H0 _
7 k- Q9 w. m: {[ 本帖最后由 wwwsnailcom 于 2006-5-24 02:15 AM 编辑 ] |
|