Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 10, Problem 3AW
Look at the following description of a problem domain:
The bank offers the following types of accounts to its customers: savings accounts, checking accounts, and money market accounts. Customers are allowed to deposit money into an account (thereby increasing its balance), withdraw money from an account (thereby decreasing its balance), and earn interest on the account. Each account has an interest rate.
Expert Solution & Answer
Learn your wayIncludes step-by-step video
schedule06:10
Students have asked these similar questions
Overview:
A new bank wants to make a simple application to keep track of all accounts and transactions.
In this TMA, it is required to help the bank manager implement the required application.
Requirements:
After a quick meeting with the bank manager, you got the following information:
It is required to store all bank accounts in one collection and all the transactions happened
in another collection.
Each account has a unique account number, a holder and balance. There is a specific prefix
(common for all accounts) that should be added to the holder's civil id to create the unique
account number. In addition, it is not allowed for a holder to have more than one account.
Furthermore, only three transactions are allowed on any account: deposit, withdrawal and
transfer money to another account.
Each holder has a unique civil ID (national id), a name and other attributes (add at least 2
attributes from your choice).
For each transaction, it is required to store the account(s) affected,…
Focus on classes, objects, methods and good programming style
Your task is to create a BankAccount class.
Class name
BankAccount
Attributes
_balance
float
_pin
integer
Methods
init ()
get_pin()
check pin ()
deposit ()
withdraw ()
get_balance ()
The bank account will be protected by a 4-digit pin number (i.e. between 1000 and 9999). The
pin should be generated randomly when the account object is created. The initial balance should
be 0.
get_pin () should return the pin.
check_pin (pin) should check the argument against the saved pin and return True if it
matches, False if it does not.
deposit (amount) should receive the amount as the argument, add the amount to the account
and return the new balance.
withraw (amount) should check if the amount can be withdrawn (not more than is in
the account), If so, remove the argument amount from the account and return the new balance if
the transaction was successful. Return False if it was not.
get_balance () should return the current balance.…
Description: a pet store application, They can
book appointments through the app, see
prices based on the kind of pet they have,
select location.
Outagery
2
Chelk typery
Beseed
functional decomposition diagram.
Pet appoint-
ment Systen
[location
[check years
I
Shop
J
check shops
blyckon wor
I
price
Show
PROCES
all shops
Came
egne
attached a picture of function decompositional
diagram for reference.
Chapter 10 Solutions
Starting Out with Python (4th Edition)
Ch. 10.1 - What is an object?Ch. 10.1 - Prob. 2CPCh. 10.1 - Why is an object's internal data usually hidden...Ch. 10.1 - What are public methods? What are private methods?Ch. 10.2 - You hear someone make the following comment: "A...Ch. 10.2 - In this chapter, we use the metaphor of a cookie...Ch. 10.2 - What is the purpose of the _ _init_ _ method? When...Ch. 10.2 - Prob. 8CPCh. 10.2 - In a Python class, how do you hide an attribute...Ch. 10.2 - What is the purpose of the _ _str_ _ method?
Ch. 10.2 - Prob. 11CPCh. 10.3 - What is an instance attribute?Ch. 10.3 - Prob. 13CPCh. 10.3 - What is an accessor method? What is a mutator...Ch. 10.4 - Prob. 15CPCh. 10.4 - Prob. 16CPCh. 10.4 - When designing an object-oriented application, who...Ch. 10.4 - How do you identify the potential classes in a...Ch. 10.4 - What are a classs responsibilities?Ch. 10.4 - What two question should you ask to determine a...Ch. 10.4 - Will all of a class's action always be directly...Ch. 10 - The _______ programming practice is centered on...Ch. 10 - The ___________ programming practice is centered...Ch. 10 - A(n) _____ is a component of a class that...Ch. 10 - Prob. 4MCCh. 10 - By doing this, you can hide a classs attribute...Ch. 10 - Prob. 6MCCh. 10 - A(n) ________ method stores a value in a data...Ch. 10 - Prob. 8MCCh. 10 - If a class has a method named _ _str_ _ , which of...Ch. 10 - A set of standard diagrams for graphically...Ch. 10 - In one approach to identifying the classes in a...Ch. 10 - Prob. 12MCCh. 10 - The practice of procedural programming is centered...Ch. 10 - Object reusability has been a factor in the...Ch. 10 - It is a common practice in object-oriented...Ch. 10 - Prob. 4TFCh. 10 - Starting an attribute name with two underscores...Ch. 10 - You cannot directly call the _ _ str _ _ method.Ch. 10 - One way to find the classes needed for an...Ch. 10 - Prob. 1SACh. 10 - Why should an object's data attributes be hidden...Ch. 10 - What is the difference between a class and an...Ch. 10 - The following statement calls an object's method....Ch. 10 - Prob. 5SACh. 10 - In a Python class, how do you hide an attribute...Ch. 10 - Prob. 7SACh. 10 - Suppose my_car is the name of a variable that...Ch. 10 - Prob. 2AWCh. 10 - Look at the following description of a problem...Ch. 10 - Pet Class The Pet class Write a class named Pet,...Ch. 10 - Car Class Write a class named Car that has the...Ch. 10 - Personal Information Class Design a class that...Ch. 10 - Employee Class Write a class named Employee that...Ch. 10 - RetailItem Class Write a class named RetailItem...Ch. 10 - Patient Charges Write a class named Patient that...Ch. 10 - Employee Management System This exercise assumes...Ch. 10 - Cash Register This exercise assumes you have...Ch. 10 - Trivia Game In this programming exercise, you will...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write a method called printDetails for a class that has a field of type String called name. The printDetai1s me...
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Will all a class's actions always be directly mentioned in the problem domain description?
Starting out with Visual C# (4th Edition)
The following perfectly valid C program was written without much attention paid to its format. As you will obse...
Programming in C
Extreme programming expresses user requirements as stories, with each story written on a card. Discuss the adva...
Software Engineering (10th Edition)
What is the purpose of the let constructs in functional languages?
Concepts of Programming Languages (11th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Object oriented programming Intellijarrow_forwardA class object can encapsulate more than one [answer].arrow_forwardSuper Class : Employee Attributes : Employee_id name, salary Methods : • Read the employee details • Display the employee details Sub class : Salary_details Attributes : HRA,CCA,DA,Gross_salary Methods : • Calculate the HRA, DA,CCA • Calculate the Gross_Salary and return the gross salary • Display the salary details. Driver Class : • Display the employee details and salary details. The following information are required for the assignment Properties with proper data types Methods with proper return types and scope Demonstration of OOP feature (Inheritance) Demonstration of OOP feature (polymorphism) Proper naming convention Proper comments in each program and within program Purpose of each code should be explained. Program Execution (output) Presentation (Word Document)arrow_forward
- INVENTORY CLASS You need to create an Inventory class containing the private data fields, as well as the methods for the Inventory class (object). Be sure your Inventory class defines the private data fields, at least one constructor, accessor and mutator methods, method overloading (to handle the data coming into the Inventory class as either a String and/or int/float), as well as all of the methods (methods to calculate) to manipulate the Inventory class (object). The data fields in the Inventory class include the inventory product number (int), inventory product description (String), inventory product price (float), inventory quantity on hand (int), inventory quantity on order (int), and inventory quantity sold (int). The Inventory class (java file) should also contain all of the static data fields, as well as static methods to handle the logic in counting all of the objects processed (counter), as well as totals (accumulators) for the total product inventory and the total product…arrow_forwardBook Donation App Create a book-app directory. The app can be used to manage book donations and track donors and books. The catalog is implemented using the following classes: 1. The app should have donors-repo.js to maintain the list of donors and allow adding, updating, and deleting donors. The donor object has donorID, firstName, lastName, and email properties. This module should implement the following functions: • getDonor(donorId): returns a donor by id. • addDonor(donor): adds a donor to the list of donors; donorID should be autoassigned a random number. • updateDonor(donor): updates the donor having the matching donorID. • deleteDonor(donorID): delete the donor with donorID from the list of donors, only if they are not associated with any books. 2. The app should have books-repo.js to maintain the list of donated books and allow adding, updating, and deleting books. The book object has bookID, title, authors, and donorID properties. • donorID references the book’s donor. This…arrow_forwardcode asaparrow_forward
- ghment #2 The application should be extendable so that a new search criterion can be added, perhaps as a new class, without having to modify the user interface. For example, a client user can add a new criteria by writing a class and registering it with the system. On adding that class, the new criterion should appear as a new item within the combo box. Search Query Search criteria Search Results: Item1 Item2 Item3arrow_forwardImplement all the classes using Java programming language from the given UML Class diagram. Note: This problem requires you to submit just two classes: Customer.java, Account.java. Do NOT include "public static void main()" method inside all of these classes. Graders will be testing your classes, using the unit-testing framework JUnit 4. Customer - ID:int -name:String -gender:char 'm' or 'f' +Customer(ID:int,name:String, discount:int) +getID():int +getName ():String +getGender ():char +toString():String "name (ID)" The Customer class models, customer design as shown in the class diagram. Write the codes for the Customer class and a test driver to test all the public methods. Accountarrow_forwardarrow_back Starting Out With Visual C# (5th Edition) 5th Edition Chapter 11, Problem 1PP arrow_back_ios PREVIOUS NEXT arrow_forward_ios Question share_out_linedSHARE SOLUTION Chapter 11, Problem 1PP Program Plan Intro Employee and ProductionWorker Classes Program plan: Design the form: Place a three text boxes control on the form, and change its name and properties to get the employee name, number, and hourly pay rate from the user. Place a four label boxes control on the form, and change its name and properties. Place a two radio buttons control on the form, and change its name and properties. Place a one group box control on the form, and change its name and properties. Place a command button on the form, and change its name and properties to retrieve the object properties and then display the values into label box. In code window, write the code: Program.cs: Include the required libraries. Define the namespace “Program11_1”. Define a class “Program”. Define a constructor for the…arrow_forward
- account.json "1000001": { "accountType": "Chequing", "accountBalance": 0 }, "1000002": { "accountType": "Savings", "accountBalance": 0 }, "1000011": { "accountType": "Chequing", "accountBalance": 0 }, "1000022": { "accountType": "Savings", "accountBalance": 0 }, "1000031": { "accountType": "Chequing", "accountBalance": 0 }, "1000032": { "accountType": "Savings", "accountBalance": 0 }, "1000051": { "accountType": "Chequing", "accountBalance": 13.699999999999989 }, "1000052": { "accountType": "Savings", "accountBalance": 0 }, "1000071": { "accountType": "Chequing", "accountBalance": 0 }, "1000081": { "accountType": "Savings", "accountBalance": 0 }, "1000091": { "accountType": "Chequing", "accountBalance": 0 }, "lastID": "1000091"} ------- var express =…arrow_forwardCreate a product_class.php script that includes a Product class with parameters: product name, product id, and price methods: print_info(): this method will print all the information related to the product set set_price(): this method takes a "price" argument and updates the corresponding parameter in the object get get_price(): this method returns the value (i.e. price) of the product Create a using_product_class.php script that creates 2 objects of the class Product and shows how to use its methods (i.e. print_info(), set_price(), and get_price())arrow_forwardDescription: a pet store application, They can book appointments through the app, see prices based on the kind of pet they have, select location. Gutagery ↓ Chelk typery pet Breed functional decomposition diagram! Pet appoint- ment System [location check years I Shop check shopy blow wear I price Show prices all shops paties appe APPLY Com attached a picture of function decompositional diagram for reference.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY