filmov
tv
Java Practice It | Exercise 9.9 MinMaxAccount | classes, implementing, inheritance, instance method
Показать описание
More practice its:
Problem:
Question:
A company has written a large class BankingAccount with many methods including:
Method/Constructor Description
public BankingAccount(Startup s) constructs a BankingAccount object using information in the Startup object s
public void debit(Debit d) records the given debit
public void credit(Credit c) records the given credit
public int getBalance() returns current balance in pennies
Design a new class MinMaxAccount whose instances can be used in place of a BankingAccount object but include new behavior of remembering the minimum and maximum balances ever recorded for the account. You should provide the same methods as the superclass, as well as the following new behavior:
Method/Constructor Description
public MinMaxAccount(Startup s) constructs a MinMaxAccount object using information in the Startup object s
public int getMin() returns minimum balance in pennies
public int getMax() returns maximum balance in pennies
The account's constructor sets the initial balance based on the Startup information. Assume that only the debit and credit methods change an account's balance.
Problem:
Question:
A company has written a large class BankingAccount with many methods including:
Method/Constructor Description
public BankingAccount(Startup s) constructs a BankingAccount object using information in the Startup object s
public void debit(Debit d) records the given debit
public void credit(Credit c) records the given credit
public int getBalance() returns current balance in pennies
Design a new class MinMaxAccount whose instances can be used in place of a BankingAccount object but include new behavior of remembering the minimum and maximum balances ever recorded for the account. You should provide the same methods as the superclass, as well as the following new behavior:
Method/Constructor Description
public MinMaxAccount(Startup s) constructs a MinMaxAccount object using information in the Startup object s
public int getMin() returns minimum balance in pennies
public int getMax() returns maximum balance in pennies
The account's constructor sets the initial balance based on the Startup information. Assume that only the debit and credit methods change an account's balance.
Java Practice It | Exercise 5.18: digitSum | if, else, Boolean logic, method basics, return
Java Practice It | Exercise 5.22: allDigitsOdd | if, else, Boolean logic, method basics, return
Java Practice It | Exercise 4.20: numUnique | if/else, method basics, return
Java Practice-it Introduction to Java Programming | Exercise 1.1 Stewie
Java Practice-it Introduction to Java Programming | Exercise 1.7 Mantra
Java Practice-it Introduction to Java Programming | Exercise 1.9 Egg
Java Exercise - Creating Classes & Methods
Java coding exercises for beginners - Methods
Java Chapter 1 Exercise Solution in Pashto | Java Practice Problems with Solutions Tutorial
Java Practice-it Introduction to Java Programming | Exercise 1.13 StarFigures
Java Practice-it Introduction to Java Programming | Exercise 1.10 Egg2
Java Practice It | Exercise 9.1: Marketer | classes, implementing, inheritance, instance methods
Java Practice It | Exercise 7.7: kthLargest | arrays, array basics
Java Practice-it Introduction to Java Programming | Exercise 1.15 EggStop
Java Practice It | Exercise 9.10: DiscountBill | classes, implementing, inheritance, instance method
Java Practice-it Introduction to Java Programming | Exercise 1.3 WellFormed
Java Practice It | Exercise 8.11 transactionFeeBankAccount | classes, instance methods
Java Practice It | Exercise 7.2: range | arrays, array basics
Java Practice It || 6.1 boyGirl || file processing, scanner, method, Math.abs, while loop, if else
Java Practice It || 4.3 season || if/ else/ else if statements, String return method, int parameters
Java Practice-it Introduction to Java Programming | Exercise 1.2 Spikey
Java Practice It || 2.1 displacement || print basics
Java Practice It | Exercise 7.1: lastIndexOf | arrays, array basics
Java Practice It | Exercise 4.10: printGPA | for loop if/else input method basics Scanner
Комментарии