ironelf's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
10 (0.02 per day)
Joined:
29-November 11
Profile Views:
43
Last Active:
User is offline Mar 16 2012 08:47 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   ironelf has not set their status

Posts I've Made

  1. In Topic: Multiple definitions error when i try and compile

    Posted 15 Mar 2012

    Thank you so much. What do you mean by linker errors though?
  2. In Topic: Multiple definitions error when i try and compile

    Posted 15 Mar 2012

    Also the complete error message is:
    build/Debug/Cygwin-Windows/_ext/1803660498/main.o: In function `_ZN14SavingsAccount8withdrawEd':
    Projects/2/savings.cpp:15: multiple definition of `SavingsAccount::withdraw(double)'
    build/Debug/Cygwin-Windows/_ext/1803660498/savings.o:/cygdrive/c/Users/Documents/Project 2/../../../Desktop/Projects/2/savings.cpp:15: first defined here
  3. In Topic: Multiple definitions error when i try and compile

    Posted 15 Mar 2012

    Sorry about the long wait i had to work. The rest of my code is:
    Checking.h:
    #ifndef CHECKING_H
    #define CHECKING_H
    #include <iostream>
    #include "account.h"
    
    class CheckingAccount : BankAccount {
    public:
        bool status;
        
        CheckingAccount(double bal, double rate) : BankAccount(bal, rate)
        {
        if(bal > 25){
        status = true;
        }else{
        status = false;
        }
        };
        
        bool checkStatus();
    
        virtual void withdraw(double);
    
        virtual void deposit(double);
    
        virtual void monthlyProc(double);
    
    
    };
    #endif
    
    

    Checking.cpp
    #include "checking.h"
    #include <iostream>
    
    bool CheckingAccount::checkStatus() {
        if (balance >= 25) {
            status = true;
        } else {
            status = false;
        }
        std::cout << "Your account status is: " << status << std::endl;
    }
    
    void CheckingAccount::withdraw(double Amount) {
        checkStatus();
        if (status == true)
            BankAccount::withdraw(Amount);
        else
            std::cout << "Your balance is below $25, deposit more in order to"
                "withdraw.\n";
    }
    
    void CheckingAccount::deposit(double Amount) {
        if (status == true){
            BankAccount::deposit(Amount);
        std::cout << "Deposited: " << Amount << " into your account." << std::endl;
    }else {
            if ((balance + Amount) >= 25) {
                status = true;
                BankAccount::deposit(Amount);
                std::cout << "Your account has been reactivated." << std::endl;
            } else {
                status = false;
                BankAccount::deposit(Amount);
                std::cout << "Your amount has been deposited but is still below "
                        "$25. Deposit more in order to withdraw." << std::endl;
            }
    
        }
    
    }
    
    void CheckingAccount::monthlyProc(double rate) {
    
        if (NumWithdraws >= 4) {
            MonthlyServiceCharge++;
            BankAccount::monthlyProc(rate);
            checkStatus();
            std::cout << "Completing the Checking Account transaction with "
                    "added service charge." << std::endl;
        } else {
            BankAccount::monthlyProc(rate);
            std::cout << "Completing basic Checking Account transaction." 
                    << std::endl;
            checkStatus();
        }
    }
    
    
    

    Uncompleted main as of right now. I want to solve these problems before i do anymore with it.
    #include "checking.cpp"
    #include "savings.cpp"
    #include <iostream>
    
    int main() {
        std::cout << "Welcome to Wide World Banking." << std::endl;
        std::cout << "Please create a Checking Account: " << std::endl;
        std::cout << "Enter the beginning balance:" << std::endl;
        double x = 1;
        while(x <= 0)
        {
        std::cin >> x;
        std::cout << "Please enter a positive balance." << std::endl;
        }
        std::cout << "Now enter your annual interest rate: " << std::endl;
        double y = 0;
        std::cin >> y;
        std::cout << "Creating your checking account now." << std::endl;
        CheckingAccount MyAcc1(x, y);
        std::cout << "Now would you like to withdraw or deposit? Enter 1 for "
                "withdraw and 2 for deposit: ";
        int choice = 0;
        int z = 0;
        bool check = false;
        while (check == false){
        std::cin >> choice;
        switch (choice){
            case 1 : check = true;
            z = 1;
            break;
            case 2 : check = true;
            z = 2;
            break;
            default : std::cout << "Enter a valid option.\n";
            check = false;
            break;
        }}
        if (z == 1) {
            std::cout << "Enter amount you would like to withdraw: ";
            double out;
            std::cin >> out;
            MyAcc1.withdraw(out);
        }else{
            std::cout << "Enter amount you would like to deposit: ";
            double in;
            std::cin >> in;
            MyAcc1.deposit(in);
        }
    }
    
    

    Also i was not asking for any code, i just want to understand what i am doing wrong here. The functions are virtual and i thought that when i want to use them i just need to have them redefined? Thank you for the help so far.
  4. In Topic: battleship program: outputting the grid does not seem to want to work

    Posted 29 Nov 2011

    what if i dont know if it is going to be true or false?
  5. In Topic: battleship program: outputting the grid does not seem to want to work

    Posted 29 Nov 2011

    i deleted the return array part and it cleared up the problem. but now when it places the pieces they run off the screen or do not get fully placed. thanks for the help is there anything else i need to do?

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

ironelf hasn't added any friends yet.

Comments

ironelf has no profile comments yet. Why not say hello?