Question

Fall 2019 CSCI 272 Test 3 - November 26, 2019 Name Add a class definition as it would appear in the header file (.h) for a Mo
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The class definitions as per the given scenario are given below:

//account class
class Account
{
//private data member declaration
double PaymentAmount;
  
public:
  
//default constructor
Account()
{
  
}
  
//function to display account information
string AccountInfo()
{
string str;
  
//code to display the account information
  
return str;
}
};

//mortgage class
class Mortgage : public Account
{
//private data member declaration
double PaymentAmount;
string PropertyAddress;
  
public:
  
//default constructor
Mortgage()
{
  
}
  
//parameterize constructor
Mortgage(double amount, string address)
{
PaymentAmount = amount;
PropertyAddress = address;
}
  
//functon to get the payment amount
double getPaymentAmount()
{
//return statement
return PaymentAmount;
}
  
//function to get the property address
string getPropertyAddress()
{
//return statement
return PropertyAddress;
}
  
//function to calculate the monthly payment
double monthlyPayment()
{
//variable declaration and initialization
int monthPayment = 0;
  
//calculate the monthly payment as per the requirement
monthPayment = PaymentAmount;
  
//return statement
return monthPayment;
}
  
//function to display the account information
//redefinition of the AccountInfo function from the base class
string AccountInfo()
{
string str;
  
//code to display the account information
  
return str;
}
};

Add a comment
Know the answer?
Add Answer to:
Fall 2019 CSCI 272 Test 3 - November 26, 2019 Name Add a class definition as...
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
  • Please show it in C++. Thank you! Problem Definition Create an inheritance hierarchy containing base class...

    Please show it in C++. Thank you! Problem Definition Create an inheritance hierarchy containing base class Account and derived class Savings-Account. Base class Account should include one data member of type double to represent the account balance. The class should provide a constructor that receives an initial baiance and uses it to initialize the data member. The class should provide three member functions. Member function credit should add an amount to the current balance. Member function debit should withdraw money...

  • he class definition for a Hank Account class, contains the following private data nembers: the name,...

    he class definition for a Hank Account class, contains the following private data nembers: the name, account number (both are character arrays of 30 elements each) alance, and interest rate Cbolth are double). It also have the following public member unctions Bank AccountO: This function is the default constructor. deposito: subsequently adjusts the balance. (balance- balance + amt) withdrawo: This function is passed an amount to withdraw and subsequently adjusts the balance. (balance balance- amt). cale interestO: This function calculates...

  • 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...

  • Create a class hierarchy to be used in a university setting. The classes are as follows:...

    Create a class hierarchy to be used in a university setting. The classes are as follows: The base class is Person. The class should have 3 data members: personID (integer), firstName(string), and lastName(string). The class should also have a static data member called nextID which is used to assign an ID number to each object created (personID). All data members must be private. Create the following member functions: o Accessor functions to allow access to first name and last name...

  • You will write the following files: mystack.h - contains the class definition for the mystack class....

    You will write the following files: mystack.h - contains the class definition for the mystack class. mystack.cpp - contains the definitions for member functions of the mystack class. inpost.cpp - contains your convert() function. inpost.h - contains the function prototype for convert() so that the main() can call it. Each of the files (with the exception of inpost.h) is described in more detail below. All header files should contain header guards to prevent them from being included multiple times in...

  • Description 1. This project will create a base account class that has the members: std::string account_code;...

    Description 1. This project will create a base account class that has the members: std::string account_code; std::string first_name; std::string last_name; double balance; Provide a constructor that initializes ALL members in its initialization list with data passed in as arguments to the constructor. Provide any accessor functions you may need (e.g. to get the account code and balance and to set the balance). In addition, include two pure virtual functions that look like the following: virtual void monthly_update() = 0; virtual...

  • Objectives You will implement and test a class called MyString. Each MyString object keeps track ...

    Objectives You will implement and test a class called MyString. Each MyString object keeps track of a sequence of characters, similar to the standard C++ string class but with fewer operations. The objectives of this programming assignment are as follows. Ensure that you can write a class that uses dynamic memory to store a sequence whose length is unspecified. (Keep in mind that if you were actually writing a program that needs a string, you would use the C++ standard...

  • 8. What are the adusn Due: November 4, 2019 1. EXCEL Spreadsheet: a. You must use...

    8. What are the adusn Due: November 4, 2019 1. EXCEL Spreadsheet: a. You must use the FINANCIAL FUNCTIONS in EXCEL to calculate your answers. b. All calculations must be done in Excel. Do not calculate anything on your calculator and just enter the number into Excel (if you do this, you will not receive credit for this assignment). Do the calculation within the cell. c You must reference cells from your base case. (Only input variables that change for...

  • The function should have a class name CPizza that will have three constructors (default, type, and...

    The function should have a class name CPizza that will have three constructors (default, type, and copyl, public functions to use and implement are noted for you in the starter kit, and private member variables (all which are allocated dynamically). The private member variables include the three different sizes of pizza (Large, Medium, and Small), cost, a bool delivery, name, and delivery fee. The prices of the pizzas' are $20. $15, and $10 for large, medium, and small respectively. The...

  • //Add name, date, and description here //preprocessor directives #de fine CRT SECURE NO WARNINGS ...

    Complete the incomplete code provided //Add name, date, and description here //preprocessor directives #de fine CRT SECURE NO WARNINGS #includestdio.h> - //Calculate the cost of the gas on a trip /Ideclare, ask, and get the price per gallon and the mpg /Icalculate and return (by reference) the cost of gas for the number of miles passed to the function void GasCost (double miles, double *gasTotalPtr) //using a 70 MPH speed limit and the miles passed to the function //calculate and...

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