Answered step by step
Verified Expert Solution
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
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 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 belowStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started