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 7761589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:10:28+00:00 2026-06-01T14:10:28+00:00

I am trying to execute the code inside of a .h File by creating

  • 0

I am trying to execute the code inside of a .h File by creating an object.. What am I doing wrong?

    //TicketFineCalculator.h
#include <iostream>
using namespace std;

class TicketFineCalculator
{

    public:
int getFine() {
        int procFee, zone, speedLimit, actualSpeed, totalFine;
     int anotherRun = 1;
     while (anotherRun == 1){
cout << "\n-------------------------------";
cout << "\nSpeeding Ticket Fine Calculator";
cout << "\n-------------------------------";
cout << "\nEnter processing fee, in dollars:";
cin >> procFee;
cout << "\nSpeeding Ticket #1";
cout << "\nEnter the type of speeding offense (1 for regular, 2 for work zone, 3 for residential district):";
cin >> zone;

cout << "\nEnter the speed limit, in miles per hour:";
cin >>  speedLimit;
cout << "\nEnter the vehicle's speed, in miles per hour:";
cin >> actualSpeed;
cout << "\nThe total fine is:" << totalFine;
cout << "\nEnter 1 to enter process another speeding ticket or 0 to quit:";
cin >> anotherRun;
     } // terminates while loop
return totalFine; 
        }
 // Calculate the total fine given the road zone, speed limit, and the vehicle's actual speed.
 // Return the fine as an integer.

};


//Project1.cpp
#include <iostream>
#include "TicketFineCalculator.h"

int totalFine;
TicketFineCalculator::getFine(totalFine);

    int main(){
    cout << totalFine;
return 0;
} //terminates main
  • 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-01T14:10:30+00:00Added an answer on June 1, 2026 at 2:10 pm

    If you want to call the getFine() method within TicketFineCalculator, you must declare the method static as in:

    class TicketFineCalculator
    {
    public:
        static getFine()
        {
        }
    };
    

    or you must create an instance of TicketFineCalculator and call the method using that instance.

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

Sidebar

Related Questions

I'm trying to execute this code (this is a minimal sample in order to
I am trying to execute this code for a listbox but its not working,
When I am trying to execute following code to email the contact form details,
Hi I m trying to execute small code in python , it is giving
I`m trying to execute linux commant 'cat' from java code, but it does not
I'm trying to execute a long-running piece of code in a background thread and
I am trying to emulate a web browser in order to execute JavaScript code
Ok, so here is the code that I'm trying to execute. begin transaction; SELECT
I'm trying the following code to execute a search and it's not working. On
I'm trying to execute MS-DOS DEL commands inside a Win32 C program, and I

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.