I'm extremely new to the coding scene and, even more so to coding with C++. I'm currently building a side program for my class as it was strongly recommended, but I can't seem to get it to compile. I keep getting a C4430 error (missing type specifier - int assumed). I'm not seeing anything like this in my reading material either, so I figured I'd reach out here for help as a second set of eyes is always a good idea. If it matters, I am coding this with Microsoft Visual Studio 2019 Community Edition. I'm still learning, but I'm also used to coding in Java at this point so I'm at a loss.
The program itself is a program I have written in Java, that I have adapted for use in C++. It's a very basic salary calculation program that spits out weekly, monthly, and annual wages while also accounting for Taxes. Initially, it had included the scanner utility in Java, but I haven't seen anything like that in C++ yet. Ideally, it would spit this information out without a problem.
I have tried adding return 0;
to the end of my code, but I am still getting the C4430. I have also reclassed my main
as double
instead of int
, to no avail.
I have included my code, below:
#include <iostream>
double salaryCalculator; main ()
{
double hourlyWage = 15.00;
int hoursWorkedWeek = 40;
double weeklyWage = 0.0;
double monthlyWage = 0.0;
double annualWage = 0.0;
double overtimeHours = 3.0;
double overtimeMulti = 1.5;
double overtimeHourlyWage = 0.0;
double overtimeTotalWage = 0.0;
overtimeHourlyWage = hourlyWage * overtimeMulti;
overtimeTotalWage = overtimeHourlyWage * overtimeHours;
std::cout << "You have /n" << overtimeHours << "hours of overtime at a rate of " << overtimeHourlyWage << "an hour, for a total of " << overtimeTotalWage;
weeklyWage = overtimeTotalWage + (hoursWorkedWeek * hourlyWage);
std::cout << "Your weekly wage is: /n" << weeklyWage;
monthlyWage = weeklyWage * 4;
std::cout << "Your monthly wage is: /n" << monthlyWage;
annualWage = weeklyWage * 52;
std::cout << "Your annual wage before taxes is: /n" << annualWage;
enum class TaxDeductions;
{
};
double incomeTax = 0.11;
double stateTax = 0.04;
double socialSecurityTax = 0.062;
double medicareTax = 0.0145;
double firstWTax = weeklyWage * incomeTax;
double secondWTax = weeklyWage * stateTax;
double thirdWTax = weeklyWage * socialSecurityTax;
double fourthWTax = weeklyWage * medicareTax;
double weeklyTax = firstWTax + secondWTax + thirdWTax + fourthWTax;
double firstMTax = monthlyWage * incomeTax;
double secondMTax = monthlyWage * stateTax;
double thirdMTax = monthlyWage * socialSecurityTax;
double fourthMTax = monthlyWage * medicareTax;
double monthlyTax = firstMTax + secondMTax + thirdMTax + fourthMTax;
double firstATax = annualWage * incomeTax;
double secondATax = annualWage * stateTax;
double thirdATax = annualWage * socialSecurityTax;
double fourthATax = annualWage * medicareTax;
double annualTax = firstATax + secondATax + thirdATax + fourthATax;
double weeklyTakeHome = weeklyWage - weeklyTax;
double monthlyTakehome = monthlyWage - monthlyTax;
double annualTakeHome = annualWage - annualTax;
std::cout << "Your weekly total take home is /n" << weeklyTakeHome;
std::cout << "Your monthly total take home is: /n" << monthlyTakehome;
std::cout << "Your annual total take home is /n" << annualTakeHome;
return 0;
}
Thank you for your time.