Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the balance and credit limit to be formatted with the decimal points like how the interest rate is. The only problem is the

image text in transcribedI need the balance and credit limit to be formatted with the decimal points like how the interest rate is. The only problem is the credit limit and balance are int data types. How do i format them to look like the interest rate,

PASS - ILUIL CULLEN Jaldice UL I 11 100, and a credit (50), getBalance returns -1050 12 // Initialize the credit limit in pennies public void setCreditLimit(int creditLimit) { this.creditLimit = creditLimit; PASS - from current balance of -1 050, and a credit (50), getBalance returns -1000 18 E // Debit only up to the credit limit @Override public boolean debit(int amountInPennies) { int calculatedNewBalance = balance - amountInPennies; PASS - with current balance of -1 000, and interestRate of 0.123, a nd applyInterest(), getBalance re turns -1123 if (calculatedNewBalance >= 0 || calculatedNewBalance * -1 = 0) { return; Account type*: Creditcard Account#.....:-111-222-333-444 Balance.....:.$-12.61 Interest rate. : 12.30% Credit limit..:$20.00 but got else balance += interestRate * balance; Account-type: Creditcard Account.#...:-111-222-333-444 Balance..:.-1261 Interest rate.: -12.30% Credit limit..:2000 41 0 // Return the string representation of a credit card account @Override public String getAccountInfo() { String string = ""; string += "Account type : Creditcard "; string += "Account # : " + accountNumber + " "; string += "Balance : " + balance + " "; string += "Interest rate : " + String.format("%.2f", interestRate*100)+"%" + " "; string += "Credit limit : " + creditLimit; NOTE: in the above text, spaces h ave been preplacedwith '. and tabs h ave been replaced with '' so that yo u can see them. Passed: 48 Failed: 3 return string; 94.12 % correct 52 // Paste your code for your creditcardAccount class below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

List the different categories of international employees. page 642

Answered: 1 week ago