This is the class declaration for FineCalculator ( int courtFee), I am attempting to calculate a speeding fine using the member function getFine( zone, speedLimit, actualSpeed). I would like all the input/output activities as shown done in main and the continued program execution "while( zone != 0 ). The delima is that speedFine does not calculate in the cout << statement in main. I thought that creating the myfc.getFine(zone, ......) object and assigning it to speedFine would make the function call. Any guidance and direction would be greatly appreciated.
/* Member functions of class FineCalculator that determines the
dollar amount that is accessed for exceeding the speed limit based
on different zones, a court fee is also included in the fine **/
#include <iostream>
using namespace std ;
#include "FineCalculator.h" // include definition of class FineCalculator
FineCalculator :: FineCalculator ( int courtFee )
{
setFeeAmount (courtFee );
fine = 0 ;
}
int FineCalculator :: getFeeAmount()
{
return feeAmount ;
}
// function that claculates the fine based on speed limit and speed in excess of speed limit
int FineCalculator :: getFine ( int a, int b, int c )
{
int speedLimit = 0 ; // contains the speed limit
int actualSpeed = 0 ; // contains the speed of the vehicle
int zone = 0 ; // contains the zone to calculate infraction amount
int speedFine = 0 ; // speed in excess of variable speed limit
int sfine = 0 ;
do // continue loop until while condition is false
{
int exceedSpeed = speedLimit - actualSpeed ;
if ( zone == 0 )
cout <<"Goodbye" << endl; // exit program
system("Pause") ;
} // end class FineCalculator
/* Creates and manipulates a FineCalculator object: Calculates
the fine amount for speeding**/
#include <string>
#include <iostream>
#include "FineCalculator.h"
; using namespace std ;
// function main begins execution of program
int main()
{
int courtFee = 0 ;
FineCalculator myfc(courtFee) ;
int speedLimit = 0 ; // contains the speed limit
int actualSpeed = 0 ; // contains the speed of the vehicle
int speedFine = 0 ; // speed in excess of variable speed limit
int zone = 0 ; // speed in excess of variable speed limit
int fine = 0 ; // speeding fine
cout <<"Enter the court fee of 62: " ;
cin >> courtFee ;
myfc.setFeeAmount( courtFee) ;
cout <<"Enter the number that corresponds with the violation type: "<< endl ;
cout << "(1) for Regular Violation "<< endl ;
cout << "(2) for Highway Violation" << endl ;
cout << "(3) for Residential Violation: " ;
cin >> zone ;
cout <<"Enter the speed limit: " ;
cin >> speedLimit ;
cout << "Enter the vehicle speed: " ;
cin >> actualSpeed ;
speedFine = myfc.getFine( zone, speedLimit, actualSpeed ) ;
cout <<"The total fine for this violation is: "<< "$" << speedFine <<endl ;
cout <<"\nEnter a 1 to enter another ticket or 0 to quit the fine claculator: " ;
cin >> zone ;
cout << endl ;