Question

Consider the following Account class and main function: class Account: acct_num=1000 #Constructor for Account class (default
det getAnnualInterestRate(self): return self. annualInterestRate def setBalance(self, balance): self.__balance = balance def
Question 1 (1 point) def transfer(self, otherAcct, amt): deposit(amt) withdraw(ant) The above method is to be included in cla
Question 2 (1 point) def _init__(self, balance - 180, annualInterestRate - %): id - type(self)._acct_num balance = balance an
Question 3 (1 point) def getMonthlyInterest (self): #MISSING CODE Which of the following statements correctly completes the i
Question 4 (1 point) def deposit (self, amount): MISSING CODE Which of the following statements correctly completes the insta
Question 5 (1 point) Study the Account class shown above. What type of variable would you assume ___annualInterestRate to be?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

The method incorrectly invokes the methods deposit and withdraw.

2)

It defines local variables instead of instance variables.

3)

return self.__balance * self.getMonthlyInterestRate() / 100

4)

self.__balance += amount

5)

an instance variable that is intended to be private (should not be directly accessed outside of the Account class)

Add a comment
Know the answer?
Add Answer to:
Consider the following Account class and main function: class Account: acct_num=1000 #Constructor for Account class (default...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The code is attached below has the Account class that was designed to model a bank account.

    IN JAVAThe code is attached below has the Account class that was designed to model a bank account. An account has the properties account number, balance, annual interest rate, and date created, and methods to deposit and withdraw funds. I need creat program using the 2 java programs.Create two subclasses for checking and savings accounts. A checking account has an overdraft limit, but a savings account cannot be overdrawn.I need to write a test program that creates objects of Account,...

  • 9.7 (The Account class) Design a class named Account that contains: • A private int data...

    9.7 (The Account class) Design a class named Account that contains: • A private int data field named id for the account (default o). • A private double data field named balance for the account (default o). • A private double data field named annualInterestRate that stores the current interest rate (default o). Assume that all accounts have the same interest rate. • A private Date data field named dateCreated that stores the date when the account was created. •...

  • Unable to find out why am I getting: Account.java:85: error: reached end of file while parsing...

    Unable to find out why am I getting: Account.java:85: error: reached end of file while parsing import java.util.*; class Account{ private int id; private double balance; private double annualInterestRate; private Date dateCreated; public Account() { id = 0; balance = 0; annualInterestRate = 0; dateCreated = new Date(); } public Account(int id1, double balance1) { id =id1; balance = balance1; dateCreated = new Date(); } public void setId(int id1) { id=id1; } public void setBalance(double balance1) { balance = balance1;...

  • def transfer(self, otherAcct, amt): withdraw(amt) otherAcct.deposit(amt) The above method is to be included in class Account...

    def transfer(self, otherAcct, amt): withdraw(amt) otherAcct.deposit(amt) The above method is to be included in class Account (shown above). It is intended to transfer the parameter amt amount from the balance of the current Account object to the balance of the parameter Account object otherAcct. What is wrong with the

  • Hello, I'm very new to programming and I'm running into a problem with the system.out.println function...

    Hello, I'm very new to programming and I'm running into a problem with the system.out.println function in the TestAccount Class pasted below. Account Class: import java.util.Date; public class Account {    private int accountId;    private double accountBalance, annualInterestRate;    private Date dateCreated;    public Account(int id, double balance) { id = accountId;        balance = accountBalance; dateCreated = new Date();    }    public Account() { dateCreated = new Date();    }    public int getId() { return...

  • PYTHON PROGRAMMING LANGUAGE Design a class named Savings Account that contains: A private int data field...

    PYTHON PROGRAMMING LANGUAGE Design a class named Savings Account that contains: A private int data field named id for the savings account. A private float data field named balance for the savings account. A private float data field named annuallnterestRate that stores the current interest rate. A_init_ that creates an account with the specified id (default 0), initial balance (default 100), and annual interest rate (default 0). . The accessor and mutator methods for id, balance, and annuallnterestRate. A method...

  • Design a class that contains: we have to make 3 files header file , one .cpp...

    Design a class that contains: we have to make 3 files header file , one .cpp file for function and one more main cpp file 9.3 (The Account class) Design a class named Account that contains: An int data field named id for the account. A double data field named balance for the account. A double data field named annualInterestRate that stores the current interest rate. A no-arg constructor that creates a default account with id 0, balance 0, and...

  • (The Account class) Design a class named Account that contains: A private int data field named...

    (The Account class) Design a class named Account that contains: A private int data field named id for the account (default 0). A private double data field named balance for the account (default 0). A private double data field named annualInterestRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. A private Date data field named dateCreated that stores the date when the account was created. A no-arg constructor that creates a default...

  • The program needs to be in python : First, create a BankAccount class. Your class should...

    The program needs to be in python : First, create a BankAccount class. Your class should support the following methods: class BankAccount (object): """Bank Account protected by a pin number.""" def (self, pin) : init "n"Initial account balance is 0 and pin is 'pin'."" self.balance - 0 self.pin pin def deposit (self, pin, amount): """Increment account balance by amount and return new balance.""" def withdraw (self, pin, amount): """Decrement account balance by amount and return amount withdrawn.""" def get balance...

  • New to python if you can add screenshort also, i am using python 3 7.3 (The...

    New to python if you can add screenshort also, i am using python 3 7.3 (The Account class) Design a class named Account that contains A private int data field named id for the account. A private float data field named annualInterestRate that stores the current A constructor that creates an account with the specified id (default 0), initial The accessor and mutator methods for id, balance, and annualInterestRate A private float data field named balance for the account. interest...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT