Data Structures and Algorithms in Java
Data Structures and Algorithms in Java
6th Edition
ISBN: 9781118771334
Author: Michael T. Goodrich
Publisher: WILEY
Question
Book Icon
Chapter 1, Problem 12R
Program Plan Intro

Processing a negative payment amount

Program plan:

  • Import the required packages.
  • Create a class CreditCard to modify the class by ignoring any request to process the negative payment amount.
  • Declare required variables.
  • The parameterized constructor CreditCard() takes the input parameters of “cust”, “bk”, “acnt”, “lim”, and “initialBal” to initialize the values.
  • The parameterized constructor CreditCard() takes the input parameters of “cust”, “bk”, “acnt”, and “lim” to initializes the values.
  • The accessor method getCustomer() is to get the customer name.
  • The accessor method getBank() is to get the bank name.
  • The accessor method getAccount() is to get the account number.
  • The accessor method getLimit() is to get the credit limit.
  • The accessor method getBalance() is to get the credit balance.
  • The method charge() is to update the balance.
  • The method makePayment() is to make a payment when amount is not a negative payment.
  • The utility method printSummary() is to display the credit card’s information.
  • In main() function.
    • Create an instance for CreditCard class.
    • Initialize the value for credit card details by invoking the parameterized constructors using wallet object.
    • Call the charge() method is to update the balance using wallet object for 3 arrays.
    • Loop executes until the wallet[] object.
      • Call the printsummary() method is to display the credit card details.
      • Loop executes until the getBalance() method value is greater than 200. If yes,
        • Call to makePayment() method to make a payment, then display the new balance.

Blurred answer
Students have asked these similar questions
The question is p8. 2
53. Write a class with two instance variables, representing an old password and a new password. Write a recursive method that returns the number of places where the two passwords have different characters. The passwords can have different lengths. Write another, nonrecursive method returning whether the two passwords are sufficiently different. The method takes an int parameter indicating the minimum number of differences that qualify the passwords as being sufficiently different. Your program should include a client class to test your class.
write code in python language

Chapter 1 Solutions

Data Structures and Algorithms in Java

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education