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
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.
function in Python called PassFail(), that returns the number of points required on the last exam in order to pass this class based on the first four exam points and the 55% exam standard mentioned in the syllabus. Note: there are a total of five exams. The first four exams are worth 100 points each. The fifth and last exam is worth 200 points.
1. Implement the above system using inheritance in the best possible way. Keep every object size as small as possible. Implement all methods (setter/getter/constructors and destructors) Note that the region area is 0 while the city is len*width and the country is the sum of their cities. 2. Create array of countries called Arab of 22 countries, Write a function fill that fills the arrav Arab 3. Write a method that finds the city that has the max area in a country 4. Write a method that sorts the cities in a country from the largest to the smallest area 5. Write a function that retums array of countries of the same area of Arab 6. Write a function that compares between two countries. It returns true if countryl area greater than country2 area. 7. Write a function to move a city from one country to another.

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