Beginner w/ numerous questions

Hello I'm new to the language and i'm in a course that's going 1 million miles per hour, could someone help me or guide me in the rite direction to complete the following exercise (I have weekly exercises that are suppose to help you out by directing you in task but we don't go over them in class so it's kind of backwards if you ask me.)

I'm trying to complete the following:


Create a class definition for an object called Account. Add a constructor and destructor to it.
Create a class CheckingAccount and make it a child class of Account.
Create a second class named Savings account and also make this class a derived class of Account.
Create private data members on the derived classes to represent balance and overdraft limits.
Implement the following class methods on classes that you think are the appropriate ones.

getBalance
getAnnualInterestRate
withdraw
deposit
getMonthlyInterest

Write a main function that instantiates a checking and savings account, and then deposit $100 into each account and set an overdraft limit on the checking account of $50.

can anyone help write that up, thanks in advance
I'm not sure what you don't understand but here's a small template to help you start:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

class Account // create Account class
{
....
Account(); // Constructor
~Account(); // Destructor notice the ~
}

class CheckingAccount: public Account 
{
... // Some code here
}

class Savings: public Account
{
... // some code here
}

/*

Definitions go here

*/
We are not here to do your homework for you. You need to make an attempt at a solution.

What have you tried? What are you having trouble with?
i tried to take a screen shot of what i had as of rite now and it wouldn't let me paste I have something similar to whats posted and i've come to the conclusion of what is all needed but i'm just having issues formatting.
Why not paste the code you have so far?

What formatting issues? That's a little vague.

You've set up the classes appropriately. Now you need to figure out what variables should go where.
Where would it make sense to put them?
this is what i have so far

//Homework for week 1
//Create a class definition for an object called Account. Add a constructor and destructor to it.
//Create a class CheckingAccount and make it a child class of Account.
//Create a second class named Savings account and also make this class a derived class of Account.
//Create private data members on the derived classes to represent balance and overdraft limits.
//Implement the following class methods on classes that you think are the appropriate ones.
//getBalance
//getAnnualInterestRate
//withdraw
//deposit
//getMonthlyInterest

//Write a main function that instantiates a checking and savings account, and then deposit $100 into each account and set an overdraft limit on the checking account of $50.

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
class Account{
int getBalance,withdraw,deposit;

public:
Account(){
Account();//default constructor
Account (double initial); //custom instructor
~Account();

class checkingAccount:public Account
{


double getBalance();
void deposit (double amount);
void withdraw (double amount);
};// functions asociated with the regular checking account

class savingsAccount:public Account {

double getBalance();
void getAnnualInterestRate();
void getMonthlyInterest();
};// functions associated with the savings account

private:
double balance;




return 0;
};

i have the following
//getBalance-Base
//getAnnualInterestRate-Savings
//withdraw-Base
//deposit-Base
//getMonthlyInterest-Savings

not sure if you seen what i have written so far i apologize i tried to do a screen cap but it wouldn't let me paste it in. When i said formatting I'm referring to the order in which everything should be typed out if that makes any sense
Topic archived. No new replies allowed.