Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8855325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:06:35+00:00 2026-06-14T14:06:35+00:00

I am trying to get this program to start running but currently I just

  • 0

I am trying to get this program to start running but currently I just get errors. I am not sure how to get this to work. If I change the class SavingsAccount to public it should be okay, but I am required to keep it as is.

The problem is in the main function.

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

class SavingsAccount
{
    int accountType;
    string ownerName;
    long ssn;
    double accountClosurePenaltyPercent, accountBalance;
    void Information();
    inline double AccountClosureLoss()
    {
        return (accountBalance * accountClosurePenaltyPercent);
    }
    void OutputInformation();

};

void SavingsAccount::Information()
{
    cout << "Enter Account Type (1 for Checking or 2 for Savings): ";
    cin >> accountType;
    cout << "Enter owner name: ";
    getline(cin, ownerName);
    cout << "Enter the Social Security Number: ";
    cin >> ssn;
    cout << "Enter the percent penalty for closing account(decimal form): ";
    cin >> accountClosurePenaltyPercent;
    cout << "Enter the account balance: ";
    cin >> accountBalance;
}

void SavingsAccount::OutputInformation()
{
    cout << "Account Type: " << endl;
    cout << "Name: " << ownerName << endl;
    cout << "SSN: " << ssn << endl;
    cout << "Account Closure Penaly %: " << accountClosurePenaltyPercent << endl;
    cout << "Account Balance: " << accountBalance;
}

int main(void)
{
    SavingsAccount.Information(); 
    SavingsAccount.AccountClosureLoss();
    SavingsAccount.OutputInformation();
    return 0;
}

What I tried so far.

int main(void)
    {
        SavingsAccount John;
        John.Information(); 
        John.AccountClosureLoss();
        John.OutputInformation();
        return 0;
    }

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:06:36+00:00Added an answer on June 14, 2026 at 2:06 pm

    Well by default member functions are private, so you can always add them into public as follows:

    class SavingsAccount
    {
        private:
        int accountType;
        string ownerName;
        long ssn;
    public:
        double accountClosurePenaltyPercent, accountBalance;
        void Information();
        inline double AccountClosureLoss()
        {
            return (accountBalance * accountClosurePenaltyPercent);
        }
        void OutputInformation();
    };
    

    You will now be able to call them from the main.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get this simple program to work on windows, but it crashes:
Im trying to get this working but for some reason it's just not right.
Hey, I am trying to get a service to start my program but it
i'm trying to get this program to break down a user defined amount of
Trying to get this expression to work, can someone look at it and tell
Trying to get this to work, with no luck: [DataMember] public Type ParameterType {
Been trying to get this up and running for a while now. Basically i
I've been trying to get this working for a while now and am just
I am trying to get this working in Scala: class MyClass(some: Int, func: AnyRef*
I am trying to get Quartz.net scheduler to work, but I don't know why

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.