47.1k views
3 votes
An employee in your company earns $32,500 annually. Write a program that determines and displays the amount of his/her gross pay for each pay period, if he/she is paid twice a month (24 pay checks per year) and if he/she is paid bi-weekly (26 check per year).

have posted this with my code but i keep getting an error. help would be appreciated
int main()
class FrankVoelker_program1{
double Pay = 32500,
bimth = Pay / 24,
biweek = Pay / 26;
cout << "Annual earnings: $" << Pay << end1;
cout << "Bimonthly earnings: $" << bimth << endl;
cout << "Biweekly earnings: $" << biweek << endl;
23:1: error: expected initializer before 'class'

1 Answer

3 votes

Answer:

The reason for the error is that the pay is declared and initialized as double, which should be a larger float data type and the main function should be in curly braces. The class should best be declared and initialized before the main function.

Step-by-step explanation:

class Fvp{

Fvp( double earning ){

double pay = earning;

float bimth = pay/24;

float biweek = pay/26;

}

}

int main( ) {

Fvp john(32500.00);

cout << '' Annual earnings: $'' << john.pay << endl;

cout << '' Bimonthly earnings: $'' << john.bimth << endl;

cout << '' Biweekly earnings: $'' << john.biweek << endl;

}

User Samuel Toh
by
5.2k points