PDA

View Full Version : Offering like Gbomb+ More. Simple Java Class Lab homework! Know java at all?



retired
04-02-2013, 12:25 PM
I honestly have not paid attention at all all semester long and My friend did my first 3 labs for free took him 20 mins and I was almost 2 months ahead of time, Now hes been busy teaching, so I NOW ONLY HAVE LAB 3 OF 8 DONE. I need all done, problem is now with lab 4 I just need to input a simple array using a tax table I have and I can send pictures of it so you could import. Once thats done the rest of the labs are literately editing or adding only 1 to 2 lines of coding, My friend says its a joke and I should be able to do it but meh, Ill never use this again. The coding is done in notepad --LOL. And the script must work on IE. I have the code all done up to lab 4, It functions. Ill send the instructions for each lab, literately only like 2 things to do for each just editing the previous. I just need a copy of the notepad after each lab is done, Like save as lab 4 and send me then edit that one save as lab 5 and send me if working. This will take anyone that knows java script and simple functions minutes im guessing. I stopped at lab 4 because I have no clue how arrays work haha if Not i would of tried it by now.

Let me know if you can do java script. I believe you will laugh at the difficulty of this assignment.

Toasted
04-02-2013, 12:45 PM
Federation, perhaps?

wrath
04-02-2013, 04:29 PM
You're saying it's javascript, not java correct? If it is javascript, I'll take a look at it, PM me the details. If it's Java then well... screw you guys, I'm going home.

retired
04-02-2013, 06:18 PM
Its just java script

wrath
04-03-2013, 03:01 AM
Its just java script

Bumping this for Retired. Some things came up and I was not able to complete everything. The code for the payroll program in question is below. The next step is to convert the prompt that's done in Javascript to an HTML form. I will rep if anyone helps complete this, and I bet Retired will too. Otherwise I will continue to work on this tomorrow!


<HTML>
<script language="JavaScript">

// Variables
document.writeln('Welcome to the online payroll processing program');
document.writeln();
go_on = 'Y'
empname = prompt('Enter any employee name','');
var tax_deduction = 0.0;

// Federal Tax Table
var fedTable = [
[ 51, 0, .15 ],
[ 525, 71.10, .28 ],
[ 1125, 239.10, .31 ],
[ 2535, 676.20, .36 ],
[ 5475, 1734.60, .396 ]
];

function do_calc()
{
if (hours > 40) gross_pay = 40 * payrate + (hours - 40) * payrate * 1.5;
if (hours <= 40) gross_pay = hours*payrate;
total_pay = gross_pay*0.0175

var settax_deduction = 0; // in case pay is less than the lowest amount
for ( var rownum = 4; rownum >= 0; --rownum )
{
//var row = fedTable[rownum];
var amount = fedTable[rownum][0];
var fixedTax = fedTable[rownum][1];
var rate = fedTable[rownum][2];
if (gross_pay <= amount);
{
tax_deduction = gross_pay;
}
if (gross_pay >= amount)
{
tax_deduction = fixedTax + (gross_pay * rate);
break; // get *OUT* of the for loop *NOW*!
}
}

}

function do_display()
{
document.writeln('The Payroll for: ',empname,'<P>');
document.writeln('Payrate: ',payrate,'<BR>');
document.writeln('Hours Worked: ',hours,'<BR>');
document.writeln('Gross Pay: ',gross_pay,'<BR>');
document.writeln('Federal Tax Witholding: ',tax_deduction,'<BR>');
document.writeln('City Tax Witholding: ',total_pay,'<BR>');
document.writeln('Total Pay After City Withholdings: ',gross_pay - total_pay,'<BR>');
document.writeln('Total Pay After Federal Withholdings: ',gross_pay - total_pay - tax_deduction);
go_on = prompt('Do you want to process another employee? Y or N','Y');
if (go_on == 'Y') empname = prompt('Enter any Employee Name','');
}

while ((empname != '') & (go_on == 'Y'))
{
payrate = prompt('Enter the Employees Payrate','');
hours = prompt('Enter the hours worked','');

// Payroll calculations
do_calc()

// Output
do_display()
}

</script>
</HTML>

retired
04-03-2013, 12:57 PM
Bump class soon :(

retired
04-04-2013, 08:50 AM
Next bump: Now