|
|
#1 |
|
Captain
![]() ![]() ![]() ![]() ![]() ![]() |
heres the code... it gives me 7 errors saying that my "else" statements dont have matching "if" statments... but they do!!! dammit all... i have an hour and a half b4 its due!!!!
#include <iostream> using namespace std; int main () { int mondayHour, tuesdayHour, wednesdayHour, thursdayHour, fridayHour, weekdayHour, saturdayHour, sundayHour, totalHour; double payRate, mondayPay, tuesdayPay, wednesdayPay, thursdayPay, fridayPay, saturdayPay, sundayPay, totalPay, saturdayMinute, weekdayMinute, sundayMinute, mondayMinute, tuesdayMinute, wednesdayMinute, thursdayMinute, fridayMinute, weekTotal, bonus, weekPay; cout << "input value for Pay Rate: \n"; cin >> payRate; // input minutes and hours cout << "input number of hours worked on Monday: \n"; cin >> mondayHour; cout << "input number of minutes worked on Monday: \n"; cin >> mondayMinute; double mondayTotal = mondayHour + mondayMinute / 60; if (mondayTotal > 8); { mondayPay = (8 * payRate) + (mondayTotal - 8) * (payRate * 1.5); } else { mondayPay = (mondayTotal * payRate); } cout << "input number of hours worked on Tuesday: \n"; cin >> tuesdayHour; cout << "input number of minutes worked on Tuesday: \n"; cin >> tuesdayMinute; double tuesdayTotal = tuesdayHour + tuesdayMinute / 60; if (tuesdayTotal > 8); { tuesdayPay = (8 * payRate) + (tuesdayTotal - 8) * (payRate * 1.5); } else { tuesdayPay = (tuesdayTotal * payRate); } cout << "input number of hours worked on Wednesday: \n"; cin >> wednesdayHour; cout << "input number of minutes worked on Wednesday: \n"; cin >> wednesdayMinute; double wednesdayTotal = wednesdayHour + wednesdayMinute / 60; if (wednesdayTotal > 8); { wednesdayPay = (8 * payRate) + (wednesdayTotal - 8) * (payRate * 1.5); } else { wednesdayPay = (wednesdayTotal * payRate); } cout << "input number of hours worked on Thursday: \n"; cin >> thursdayHour; cout << "input numbr of minutes worked on Thursday: \n"; cin >> thursdayMinute; double thursdayTotal = thursdayHour + thursdayMinute / 60; if (thursdayTotal > 8); { thursdayPay = (8 * payRate) + (thursdayTotal - 8) * (payRate * 1.5); } else { thursdayPay = (thursdayTotal * payRate); } cout << "input number of hours worked on Friday: \n"; cin >> fridayHour; cout << "input number of minutes worked on Friday: \n"; cin >> fridayMinute; double fridayTotal = fridayHour + fridayMinute / 60; if (fridayTotal > 8) { fridayPay = (8 * payRate) + (fridayTotal - 8) * (payRate * 1.5); } else { fridayPay = (fridayTotal * payRate); } cout << "input number of hours worked on Saturday: \n"; cin >> saturdayHour; cout << "input numbr of minutes worked on Saturday: \n"; cin >> saturdayMinute; double saturdayTotal = saturdayHour + saturdayMinute / 60; if (saturdayTotal > 8); { saturdayPay = (8 * payRate) + (saturdayTotal - 8) * (payRate * 1.5); } else { saturdayPay = (saturdayTotal * payRate); } cout << "input number of hours worked on Sunday: \n"; cin >> sundayHour; cout << "input numbr of minutes worked on Sunday: \n"; cin >> sundayMinute; double sundayTotal = sundayHour + sundayMinute / 60; if (sundayTotal > 8); { sundayPay = (8 * payRate) + (sundayTotal - 8) * (payRate * 1.5); } else { sundayPay = (sundayTotal * payRate); } // if statement for Total Hours weekTotal = mondayTotal + tuesdayTotal + wednesdayTotal + thursdayTotal + fridayTotal + saturdayTotal + sundayTotal; weekPay = mondayPay + tuesdayPay + wednesdayPay + thursdayPay + fridayPay + saturdayPay + sundayPay; if (weekTotal > 60); { bonus = (60 - weekTotal) * (payRate / 2); totalPay = weekPay + bonus; } else { totalPay = weekPay; } cout << totalPay <<"\n"; return EXIT_SUCCESS; }
__________________
http://jedilightfoot.deviantart.com |
|
|
|
|
|
#2 |
|
the lemonizer
![]() ![]() ![]() ![]() ![]() |
the ; after the ifs, take em out...
lol Simmons TYPE-R ![]() |
|
|
|
|
|
#3 |
|
Captain
![]() ![]() ![]() ![]() ![]() ![]() |
UPDATED CODE
#include <iostream>
using namespace std; int main () { int mondayHour, tuesdayHour, wednesdayHour, thursdayHour, fridayHour, saturdayHour, sundayHour; double payRate, mondayPay, tuesdayPay, wednesdayPay, thursdayPay, fridayPay, saturdayPay, sundayPay, totalPay, saturdayMinute, sundayMinute, mondayMinute, tuesdayMinute, wednesdayMinute, thursdayMinute, fridayMinute, weekTotal, bonus, weekPay; cout << "input value for Pay Rate: \n"; cin >> payRate; // input minutes and hours cout << "input number of hours worked on Monday: \n"; cin >> mondayHour; cout << "input number of minutes worked on Monday: \n"; cin >> mondayMinute; double mondayTotal = mondayHour + mondayMinute / 60; if (mondayTotal > 8) { mondayPay = (8 * payRate) + (mondayTotal - 8) * (payRate * 1.5); } else { mondayPay = (mondayTotal * payRate); } cout << "input number of hours worked on Tuesday: \n"; cin >> tuesdayHour; cout << "input number of minutes worked on Tuesday: \n"; cin >> tuesdayMinute; double tuesdayTotal = tuesdayHour + tuesdayMinute / 60; if (tuesdayTotal > 8) { tuesdayPay = (8 * payRate) + (tuesdayTotal - 8) * (payRate * 1.5); } else { tuesdayPay = (tuesdayTotal * payRate); } cout << "input number of hours worked on Wednesday: \n"; cin >> wednesdayHour; cout << "input number of minutes worked on Wednesday: \n"; cin >> wednesdayMinute; double wednesdayTotal = wednesdayHour + wednesdayMinute / 60; if (wednesdayTotal > 8) { wednesdayPay = (8 * payRate) + (wednesdayTotal - 8) * (payRate * 1.5); } else { wednesdayPay = (wednesdayTotal * payRate); } cout << "input number of hours worked on Thursday: \n"; cin >> thursdayHour; cout << "input numbr of minutes worked on Thursday: \n"; cin >> thursdayMinute; double thursdayTotal = thursdayHour + thursdayMinute / 60; if (thursdayTotal > 8) { thursdayPay = (8 * payRate) + (thursdayTotal - 8) * (payRate * 1.5); } else { thursdayPay = (thursdayTotal * payRate); } cout << "input number of hours worked on Friday: \n"; cin >> fridayHour; cout << "input number of minutes worked on Friday: \n"; cin >> fridayMinute; double fridayTotal = fridayHour + fridayMinute / 60; if (fridayTotal > 8) { fridayPay = (8 * payRate) + (fridayTotal - 8) * (payRate * 1.5); } else { fridayPay = (fridayTotal * payRate); } cout << "input number of hours worked on Saturday: \n"; cin >> saturdayHour; cout << "input numbr of minutes worked on Saturday: \n"; cin >> saturdayMinute; double saturdayTotal = saturdayHour + saturdayMinute / 60; if (saturdayTotal > 8) { saturdayPay = (8 * payRate) + (saturdayTotal - 8) * (payRate * 2.25); } else { saturdayPay = (saturdayTotal * (payRate * 1.5)); } cout << "input number of hours worked on Sunday: \n"; cin >> sundayHour; cout << "input numbr of minutes worked on Sunday: \n"; cin >> sundayMinute; double sundayTotal = sundayHour + sundayMinute / 60; if (sundayTotal > 8) { sundayPay = (8 * payRate) + (sundayTotal - 8) * (payRate * 3); } else { sundayPay = (sundayTotal * (payRate * 2)); } // if statement for Total Hours weekTotal = mondayTotal + tuesdayTotal + wednesdayTotal + thursdayTotal + fridayTotal + saturdayTotal + sundayTotal; weekPay = mondayPay + tuesdayPay + wednesdayPay + thursdayPay + fridayPay + saturdayPay + sundayPay; if (weekTotal > 60) { bonus = (60 - weekTotal) * (payRate / 2); totalPay = weekPay + bonus; } else { totalPay = weekPay; } cout << totalPay <<"\n"; return EXIT_SUCCESS; } |
|
|
|
|
|
#4 |
|
Lieutenant Commander
![]() ![]() ![]() ![]() |
what do u want it to do??? my friends might be able to help a bit
__________________
m00...ph34r t3h n00b ![]() [-=1manclan=-]n00b |
|
|
|
|
|
#5 | |
|
Captain
![]() ![]() ![]() ![]() ![]() ![]() |
Quote:
well its supposed to take several variables dealing with payrates and hours worked and compile how much a person should get paid for their hours and minutes worked... and the main reason im posting it is so i can sho sho.gun ... if u buds have any input maybe itll help ![]() |
|
|
|
|
|
|
#6 |
|
Lieutenant Commander
![]() ![]() ![]() ![]() |
i confused my buddies ^^"
|
|
|
|
|
|
#7 | |
|
Captain
![]() ![]() ![]() ![]() ![]() ![]() |
Quote:
ahh dont worry dudeski... i found all the bugs with sho.guns help... and i emailed my submission file with half an hour to spare... good times ![]() |
|
|
|
|
|
|
#8 |
|
Fleet Admiral
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2000
Location: 742 Evergreen Terrace, Springfield USA
Posts: 9,276
|
where are you taking this class hang10? Is this a c++ class?
__________________
|
|
|
|
|
|
#9 |
|
Vice Admiral
![]() ![]() ![]() ![]() |
this sort of looks like java.
But hey...I could be really wrong. Anywho Hang10...are you asking us to Cheat? Because if you are...I have no idea what to do. And if you arn't. I still have no idea what the heezies this is!
__________________
Life is like toilet paper, long and useful! The stars at night, are big and bright *clap 4x* deep in the heart of TEXAS! |
|
|
|
|
|
#10 | |
|
Fleet Admiral
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2000
Location: 742 Evergreen Terrace, Springfield USA
Posts: 9,276
|
Quote:
i've never really programmed in java but i don't think you'd use #include <iostream> and using namespace std; in java. I just found it strange how they're teaching him programming in c++ but there isn't a single object in his code. |
|
|
|
|
|
|
#11 |
|
Rear Admiral Upper Half
![]() ![]() ![]() |
the main program block is similar in java to c, but vary different. By looking at this block one can determine what language it is.
java: public static void main(String args[]) c/c++: int main ()
__________________
http://ribitch.com/ipod.html |
|
|
|