Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In [1]: In [2]: Q1. Define a class which has at least two methods: getString: to get a string from console input printString: to

imageimage

In [1]: In [2]: Q1. Define a class which has at least two methods: getString: to get a string from console input printString: to print the string in upper case. Also please include simple test function to test the class methods. Hints: Use init method to construct some parameters (30 points) #Your Code is here Q2. Create a Python class called BankAccount which represents a bank account, having as attributes: accountNumber (numeric type), name (name of the account owner as string type), balance. Create a constructor with parameters: account Number, name, balance. Create a Deposit() method which manages the deposit actions. Create a Withdrawal() method which manages withdrawals actions. Create an bankFees() method to apply the bank fees with a percentage of 5% of the balance account. Create a display() method to display account details. Give the complete code for the BankAccount class. For example: Testing the code: newAccount = BankAccount(2178514584, "Albert", 2700) Creating Withdrawal Test newAccount. Withdrawal (300) Create deposti test newAccount. Deposit(200) Display account informations newAccount.display() (40 points) #Your Code is Here #Hints: # create the class # create the constuctor with parameters: account Number, name and balance #create Deposit() method #create Withdrawal method # create bankFees() method # create display() method # Testing the code : # Creating Withdrawal Test # Create deposit test # Display account informations In [3]: Q3. a) Define two classes, called Dog and Cat, which have the same 3 methods including the contstuctor. After defining the classes, create two objects then write a for loop to obtain the following output: (30 points) Meow I am a cat. My name is Kitty. I am 2.5 years old. Meow Bark I am a dog. My name is Fluffy. I am 4 years old. Bark Hint: The Method names, other than the constructor, can be make_sound and info methods #Your code here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Q1 Heres the implementation of the class with the required methods python class StringManipulator de... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Accounting

Authors: Kin Lo, George Fisher

Volume 1, 1st Edition

132612119, 978-0132612111

More Books

Students also viewed these Programming questions