Ask Question, Ask an Expert


Ask C/C++ Expert

Home >> C/C++

problem 1) The code given defines the start of the class to represent bank accounts:

class BankAccount(object):
interest_rate = 0.3
def __init__(self, name, number, balance): = name
self.number = number
self.balance = balance

a) prepare down the name of the class variables and instance variables in the given code.

b) Add instance methods called deposit() and withdraw() that increase and decrease balance of the account. Ensure that withdraw() method does not permit the account to go into overdraft. Add a third method called add_interest() that adds interest to balance (the interest must be the interest rate multiplied by the present balance).

c) Create subclass of BankAccount known as StudentAccount. Every StudentAccount must have the overdraft limit of 1000. prepare down a constructor for the new class. Override the withdraw() method to ensure that students can withdraw money up to their overdraft limits.

problem 2)A palindromic word is one which reads same backwards as forwards. Therefore the words peep and deed are palindromes.

a) Create down a class called Palindrome.

b) In your Palindrome class, produce a method called reverse() that takes a string argument. Your method must return reverse of the argument as a string. For instance, if argument is Foobar then your method must return rabooF.

c) Make a second method in Palindrome called isPalindrome() that takes a string argument. This method must return True if argument is a palindrome and False otherwise.

d) prepare some code to test your new Palindrome class and print out results of your testing to the user. Provide some consideration to what sort of strings you might want to use for your testing.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M910507

Have any Question? 

Related Questions in C/C++

A write an array implementation of self-adjusting lists in

a. Write an array implementation of self-adjusting lists. In a self-adjusting list, all insertions are performed at the front. A self-adjusting list adds a find operation, and when an element is accessed by a find, it is ...

1 requirementsin this assignment you can unleash your

1. REQUIREMENTS In this assignment, you can unleash your imaginations and use OpenGL with C/C++ programming to produce a scene(s) that represents what you envision could possibly be seen under the sea. Please note that a ...

Problem 1 you are tasked to write a program that outputs

PROBLEM 1 You are tasked to write a program that outputs the following amplifier system specifications: Voltage amplification: 25 Input voltage: 50 mV Power output: 2.5 W Bandwidth: 15 kHz Type: Class A a. For this progr ...

Computer scienceprogram-write a c program that willpresent

Computer Science Program- Write a C++ program that will: Present the user with a menu of choices: 1. Random number 2. String 3. Type Casting 4. Integer Math Then, in an if-else if structure (or switch) write the code for ...

Here are two examplesifcounter7continueifcounter7break1

Here are two examples: if(counter==7) continue; if(counter==7) break; 1. Write a for loop that counts only the odd numbers out of the first five numbers entered from the keyboard, but does not count (skips) the number 7. ...

Pa 1 word countertabulating basic document statistics is an

PA #1: Word Counter Tabulating basic document statistics is an interesting exercise that leverages your knowledge of strings, files, loops, and arrays. In this homework, you must write a C++ program that asks the user fo ...

This program involves using stl listsfor this program you

This program involves using STL lists. For this program you will implement three functions whose prototypes are given below: list ::iterator mxIter(list ::iterator first, list ::iterator last); void selectSort(list & aLi ...

Question 1you are facing the following problem you are

Question 1 You are facing the following problem: You are given a robot and your task is to "guide" the robot through a 2-dimensional maze such that the robot can reach a desired goal state. Assume that the maze is define ...

Q 1 write a c program to declare two integer one float

Q. 1 Write a C++ program to declare two integer , one float variables and assign 10, 15, and 12.6 to them respectively. It then prints these values on the screen. Q. 2 Write a C++ program to prompt the user to input her/ ...

More often than not entrepreneurs will fail several times

"More often than not, entrepreneurs will fail several times before they make it and will usually learn a lot in the process. To help these entrepreneurs to succeed will require a cultural shift. We need to encourage Aust ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate