1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
xeze [42]
3 years ago
5

Assume the existence of a BankAccount class. Define a derived class, SavingsAccount that contains two instance variables: the fi

rst a double, named interestRate, and the second an integer named interestType. The value of the interestType variable can be 1 for simple interest and 2 for compound interest. There is also a constructor that accepts two parameters: a double that is used to initialize the interestRate variable, and a string that you may assume will contain either "Simple", or "Compound", and which should be used to initialize the interestType variable appropriately. There should also be a pair of functions getInterestRate and getInterestType that return the values of the corresponding data members (as double and int respectively).
Computers and Technology
1 answer:
Fynjy0 [20]3 years ago
8 0

Answer:

Class SavingsAccount : public BankAccount

{

double interestRate;

int interestType;

public SavingsAccount(double interestRate, string interestType)

{

this.interestRate=interestRate;

if(interestType=="Simple")

this.interestType=1;

else if(interestType=="Compound")

this.interestType=2;

}

public double getInterestRate()

{

return this.interestRate;

}

public int getInterestType()

{

return this.interestType;

}

}

Explanation:

You might be interested in
Write a Python program which asks a user for a word and performs letters manipulation. If the word is empty, the program should
never [62]

Answer:

The program is as follows:

word = input("Enter a word: ")

if word:

   if len(word) <= 4:

       word = word[::-1]

   else:

       word = word[0]+word[1]+word[-2]+word[-1]

   print(word)

else:

   print('empty!')

Explanation:

This gets input for word from the user

word = input("Enter a word: ")

If input is not empty

if word:

This checks if the length is less than or equal to 4 characters

   if len(word) <= 4:

If yes, this reverses the word

       word = word[::-1]

If otherwise,

   else:

This gets the first, second, second to last two characters

       word = word[0]+word[1]+word[-2]+word[-1]

Print the new string

   print(word)

Print empty, if input is empty

<em>else: </em>

<em>    print('empty!')</em>

8 0
3 years ago
Which of the following statements expresses why the following code is considered bad form? for (rate = 5; years-- &gt; 0; System
OlgaM077 [116]

Answer:

l and ll only that is the answer

7 0
3 years ago
Read 2 more answers
What is the term for the era created by the digital revolution?
ollegr [7]
We are in the modern era and the information era
8 0
3 years ago
How to deactivate the brainly app?​
galina1969 [7]

Answer:

Don't you just uninstall it?

Explanation:

5 0
2 years ago
Read 2 more answers
Why does binary addition have a rule for 1 + 1 + 1 if only two numbers<br> are being added together?
dalvyx [7]

Answer:

See below

Explanation:

Because sometimes you have to 'carry' a 1 over to the ext column when adding two binary numbers

Example :

 1 1 1

<u>+1 1 1 </u>    <==== starting in the first R column add  1 + 1  to get 0 and carry 1

                then the next column you will add   1 + 1 + 1  = 1   and carry 1 again

                    then 1 + 1 + 1= 1  and carry 1 again (to column 4)  to get

1   1  1 0

5 0
2 years ago
Other questions:
  • Is the answer a,b,c,d
    8·1 answer
  • Which are the benefits of leveraging web technologies?
    8·2 answers
  • Which of these is the proper flow for an Auto Trans cooling system?
    7·2 answers
  • Which of the following is the core of an operating system that maintains the computer’s clock, starts applications, and assigns
    5·1 answer
  • When Judy logged on the network, she faced the message requesting that she changes her password. So, she changed her password. B
    10·1 answer
  • What is Java Script?
    13·1 answer
  • Assume that sentence is a variable that has been associated with a string consisting of words separated by single space characte
    5·1 answer
  • In dynamic programming, the technique of storing the previously calculated values is called A. Saving value property B. Storing
    7·1 answer
  • Which term describes a visual object such as a picture a table or text box
    15·2 answers
  • question 2 which data link layer protocol defines the process by which lan devices interface with upper network layer protocols?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!