I am currently in a C++ course and I am having problems with one of my assignments. The question is below (number 4), and then what I have is below that. If anyone can provide some assistance to what I am doing wrong, it will be greatly appreciated.
3. Workers at a particular company have won a 7.6% pay increase retroactive for 6 months. Write a program that takes an employee's previous annual salary as input, and outputs the amount of retroactive pay due the employee, the new annual salary, and the new monthly salary. Use a variable declaration with the modifier const to express the pay increase. Your program should allow the calculation to be repeated as often as the user wishes.
4. Modify your program from Programming Project 3 so that it calculates the retroactive salary for a worker for any number of months, instead of just 6 months. The number of months is entered by the user.
What I currently have and the error I am getting:
#include <iostream>
using namespace std;
const float retroactivepay = 1.076f;
int main()
{
int current_salary, new_annual_salary, retroactive_pay, new_monthly_salary, number_of_months;
cout << "Press return after entering a number.\n";
cout << "Enter your current salary?: ";
cin >> current_salary;
cout << "Enter the number of months you wish to calculate your retroactive pay: ";
cin >> number_of_months;
cout << "Your new annual salary is: ";
cout << new_annual_salary;
cout << "\n";
cout << "The amount of retroactive pay due to you is: ";
cout << retroactive_pay;
cout << "\n";
cout << "Your new monthly salary is: ";
cout << new_monthly_salary;
cout << "\n";
return 0;
}
Error:
1>c:\users\freeman\desktop\tate_cis110_module_1\tate_cis110_module_1\cis110_module_1_page103_programmingproject4.cpp(15): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
1>CIS110_Module_1_ProgrammingProject2.obj : error LNK2005: _main already defined in CIS110_Module_1_Page103_ProgrammingProject4.obj
1>CIS110_Module_1_ProgrammingProject3.obj : error LNK2005: _main already defined in CIS110_Module_1_Page103_ProgrammingProject4.obj
1>C:\Users\Freeman\Desktop\Tate_CIS110_Module_1\Debug\Tate_CIS110_Module_1.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Once again, if anyone can provide some help it will be greatly appreciated.