DescriptionA bank has decided to renew its policy; according to the new policy, you can only own a savings account with minimum savings of Rs.1000. Construct a class ‘SavingAmount’ with only one integer instance variable ‘saving’. The class will have the following methods in it: A setter method 'setInitialSaving' that will take an integer as a parameter and set the value of savings equal to that of the integer .A getter method 'getCurrentSaving' that will return the saving .An increment method that will increase the savings by Rs.1000 .A decrement method that will decrease the savings by Rs.100 .A method to check the savings of a person say 'checkSaving'. If the savings amount is greater than or equal to Rs.1000, print “Congratulations! You have saved a good amount”. If the amount is less than Rs.1000 and greater than or equal to 0, print “Insufficient saving!”. If the savings amount is less than 0, print “You are in debt”.Input: Your program should take the integer amount.Output: The output should be in the following format.Call the 'decrementSaving' method once.Call the incrementSaving' method once.Call the 'checkSaving' method.Display the total savings.Sample Input:20000 Sample Output:Congratulations! You have saved a good amountYour current savings are Rs 20900Sample Input:-1000 Sample Output:You are in debtYour current savings are Rs 100Sample Input:-100 Sample Output:Insufficient saving!Your current savings are Rs 800
Question
DescriptionA bank has decided to renew its policy; according to the new policy, you can only own a savings account with minimum savings of Rs.1000. Construct a class ‘SavingAmount’ with only one integer instance variable ‘saving’. The class will have the following methods in it: A setter method 'setInitialSaving' that will take an integer as a parameter and set the value of savings equal to that of the integer .A getter method 'getCurrentSaving' that will return the saving .An increment method that will increase the savings by Rs.1000 .A decrement method that will decrease the savings by Rs.100 .A method to check the savings of a person say 'checkSaving'. If the savings amount is greater than or equal to Rs.1000, print “Congratulations! You have saved a good amount”. If the amount is less than Rs.1000 and greater than or equal to 0, print “Insufficient saving!”. If the savings amount is less than 0, print “You are in debt”.Input: Your program should take the integer amount.Output: The output should be in the following format.Call the 'decrementSaving' method once.Call the incrementSaving' method once.Call the 'checkSaving' method.Display the total savings.Sample Input:20000 Sample Output:Congratulations! You have saved a good amountYour current savings are Rs 20900Sample Input:-1000 Sample Output:You are in debtYour current savings are Rs 100Sample Input:-100 Sample Output:Insufficient saving!Your current savings are Rs 800
Solution
Here is a Python solution for the problem:
class SavingAmount:
def __init__(self):
self.saving = 0
def setInitialSaving(self, amount):
self.saving = amount
def getCurrentSaving(self):
return self.saving
def incrementSaving(self):
self.saving += 1000
def decrementSaving(self):
self.saving -= 100
def checkSaving(self):
if self.saving >=
Similar Questions
Create a SavingsAccount class that behaves just like a BankAccount using inheritanceCreate a SavingsAccount class that behaves just like a BankAccount, but also has an interest rate and a method that increases the balance by the appropriate amount of interest (Hint:use Inheritance).Note: Refer to the displayed test cases for better understanding.Sample Test CasesTest Case 1:Expected Output:account·number:784569874account·holder·name:Raviinitial·balance:50000interest·rate:2Savings·Account·Created:Account·Number:784569874Account·Holder:RaviBalance:50000.0Interest·Rate:2.0%After·adding·interest:Balance:·51000.0Test Case 2:Expected Output:account·number:547981235account·holder·name:Ramanainitial·balance:90000interest·rate:2.5Savings·Account·Created:Account·Number:547981235Account·Holder:RamanaBalance:90000.0Interest·Rate:2.5%After·adding·interest:Balance:·92250.0
Assume that a bank maintains two kinds of accounts for customers, one called as savings account and the other as current account. The saving account provides compound interest (9%) and withdrawal facilities but not cheque book facility. The current account provides cheque book facility but no interest. Current account holders should also maintains a minimum balance of 500 and if the balance falls below this level, a service charge (Rs. 50) is imposed. Create a class Account as abstract that stores customer name, account number and opening balance (Rs. 500). From this derive the classes Current and Saving to make them more specific to their requirements. Include necessary member functions in order to achieve the following tasks:Get the account details using constructor.Display the account details using friend function.Deposit an amount (Rs. 10000) for a customer and update the balanceCompute and deposit interest. Now display the balance using inline function.Withdraw amount (Rs. 10200) for a customer after checking the balance and update the balance.Check for the minimum balance (for current account holders), impose penalty, if necessary, and update the balance.Count the number of transactions carried out using static member variable and display the count value by static member function OUTPUTAmount deposited successfullyCurrent Balance:10500Interest deposited successfullyCurrent Balance:10695Insufficient balance. Penalty of 50 imposedCustomer Name:JohnAccount Number:123456Current Balance:10695Customer Name:JaneAccount Number:654321Current Balance:450Total number of transactions:3
Write a java program to create a bank account with Name of the account holder, type of account(savings or current), Account number and Balance amount in the account. Also, create 5 customers for the class Bank_account using array of objects. Access the customers to perform credit, debit and display of balance. Input 1: Enter the customers: Reena Savings 123 1000 Robin Current 456 2000 Praveen Savings 789 3000 Sherin Current 234 2500 Deena Savings 567 2000 Enter choice: 1. Credit 2. Debit
If households in the economy decide to take money out of checking account deposits and put this money into savings accounts, this will initiallyQuestion 5Answera.decrease M1 and decrease M2.b.increase M1 and decrease M2.c.decrease M1 and not change M2.d.decrease M1 and increase M2.
Test time left: 01:48:03Create a SavingsAccount class that behaves just like a BankAccount using inheritanceCreate a SavingsAccount class that behaves just like a BankAccount, but also has an interest rate and a method that increases the balance by the appropriate amount of interest (Hint:use Inheritance).Note: Refer to the displayed test cases for better understanding.Sample Test CasesTest Case 1:Expected Output:account·number:784569874account·holder·name:Raviinitial·balance:50000interest·rate:2Savings·Account·Created:Account·Number:784569874Account·Holder:RaviBalance:50000.0Interest·Rate:2.0%After·adding·interest:Balance:·51000.0Test Case 2:Expected Output:account·number:547981235account·holder·name:Ramanainitial·balance:90000interest·rate:2.5Savings·Account·Created:Account·Number:547981235Account·Holder:RamanaBalance:90000.0Interest·Rate:2.5%After·adding·interest:Balance:·92250.0
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.