Jump to content
Killersites Community

fab5freddy

Member
  • Content Count

    17
  • Joined

  • Last visited

Community Reputation

0 Neutral

About fab5freddy

  • Rank
    Member
  1. fab5freddy

    record set duplicates

    Thanks for checking out on the problem I have solved it. It was just a matter of missing a few things which happens from time to time
  2. fab5freddy

    record set duplicates

    So far my result is a list of over 900 zip codes. I have to find the duplicates and remove them, but am getting quite confused on this.
  3. fab5freddy

    record set duplicates

    I have went to many of the sites you told me about and have found great information. However I can not find out how to turn a recordset into an array. I know this is very basic, but it's just something I have missed. Here's my new code. /* This is the JavaScript code for "Find Unique Zip Codes" File: /unit5/project/project5Part1.html */ function project5Part1() { var myArray = new Array(); var sortedArrayOfStudents; var zipCodeRecords; var output; var arrayOfZipCodes; var test = ""; output = document.getElementById("outputDiv"); zipCodeRecords = openZipCodeStudyRecordSet(); while (zipCodeRecords.readNextRecord()) { arrayOfZipCodes = zipCodeRecords.getSampleZipCode(); myArray = arrayOfZipCodes; test += myArray + "<br />"; } output.innerHTML = test + "<br />"; //will have to fix output return false; }
  4. fab5freddy

    record set duplicates

    I am wondering how to filter results out of a record set. I have to find all of the "unique zip codes" in a record set and than display them. I have a start to the program where it displays all of the zip codes I'm just not sure how to filter out the duplicate so the don't show up. If I can do it as an array I think I know how to do it. I just need a little help in the right direction. Here is what I have so far. function project5Part1() { //Constant Variables ZERO = 0; // Variable Declarations var zipCode; var output; var records; var count = ZERO; var display = ""; // Display results output = document.getElementById("outputDiv"); // Open the Zip Code Study Records and make them // available to the script records = openZipCodeStudyRecordSet(); while (records.readNextRecord()) { zipCode = records.getSampleZipCode(); count++; } // Output the results output.innerHTML = display + "<br />"; }
  5. fab5freddy

    Form Validation

    I have recently started working on form validation in my class and have gotten stuck on a few things . The first one is I am unsure how to run a test for presses of the space bar. Here is what I have so far. When I put spaces in the text box it still validates and sends the form through. This are both sections taken out of a working function just these two things do not work. if (document.forms[0].artistIdNumber.value.length == " ") { alert("Artist Id cannot contain spaces."); document.forms[0].artistIdNumber.select(); return false; } Also I am having a problem testing for a positive number as well. The number needs to be greater than zero. Here is my code for that. if (document.forms[0].productWeight < 0) { alert("Need to have a positive number"); return false; }
  6. fab5freddy

    Javascript Histogram

    You're right I agree with you about having other resources however we don't have class this week. As far as the book is concerned it is no good what so ever. There have been several complaints to the instructor to find us a new one. All he responds with is we should be able to find additional resources on our own. This can be a little overwhelming to a new student. This is not really the best class I've ever been as you can imagine. Only a few weeks to go.
  7. fab5freddy

    Javascript Histogram

    I have run into a little trouble. I need to create a histogram by accessing a database and retrieving numbers from the database. I can list all the database information however when it comes to the histogram part all I get is a lot of x's that crashes the whole program. I need to use the numbers from the currentStockAmount. If more information is needed let me know here is my code so far: function project4Part3() { var currentNumber; var currentName; var currentStockAmount; var itemRecords; //Open Inventory Items itemRecords = openInventoryItemsRecords(); //Read records and display while (itemRecords.readNextRecord()) { currentNumber = itemRecords.getItemNumber(); currentName = itemRecords.getItemDescription(); currentStockAmount = itemRecords.getItemStockAmount(); currentStockAmount = Number(currentStockAmount); document.write(currentNumber + "\t" + currentName + "\t" + currentStockAmount + "\n"); } } I think I need to convert the currentStockAmount to a Number but am unsure.
  8. fab5freddy

    Basic jquery ?

    I figured it out I had to do the math in the if statement to get the results I wanted. It was what you said about going back and looking at the math that made me remember an issue I ran into early. Thanks again.
  9. fab5freddy

    Basic jquery ?

    All the other results are correct. I'm gonna just take a little rest from it and look at it tomorrow more which usually helps. I really appreciate all the help you have given me. You have been a great help. I was wondering if you knew any good books or websites for a beginner the book my instructor has us using doesn't follow along with the course work at all and is very frustrating. He just tells us to go out on are own and find books. However for a beginner and can be a little overwhelming trying to find a decent book to start with. Once again thanks for your help.
  10. fab5freddy

    Basic jquery ?

    When I use the code totalPay = totalPay + grossPay; I get 31428.75 the answer I need to come up with is 31796.25. Using the code I provided here is the chart with results. I need the numbers listed under Gross Pay to equal 31796.25. I had to attach the chart since I could figure out any other way to add it. If there is an easier way let me know. Chart.rtf
  11. fab5freddy

    Basic jquery ?

    I still can't get it to work. The problem is I have to different totals under gross pay. One for people who worked over 35 with over time pay and another one for people who worked 35 hours and under with no over time pay. Here is the exact problem description: "Design a program that will process the weekly employee time cards for all the employees of an organization. Each employee time card will have the these data items: an employee number, an employee name, an hourly wage rate, and the number hours worked during the week. Each employee is to be paid time-and-a-half for all hours worked over 35. A tax amount of 15% of gross salary is to be withheld. The output to the screen should display the employee's number and name, gross pay, withholding amount, and net pay. At the end of the report, display the total payroll amount and the average amount paid per employee." Everything is great it's the total part at the end of the report I can't get. Here is my code so far: /* This is the JavaScript code for "Employee Payroll" File: /unit4/project/project4Part2.html */ function project4Part2() { // Your code goes in here. //Constant Variables var ZERO = 0; var THIRTY_FIVE = 35; var ONE_AND_HALF = 1.5; var FIFTEEN_PERCENT = .15 //Variables var employeeNumber; var employeeName; var employeeWage; var employeeHours; var regularPay; var grossPay; var overTimePay; var overTimeHours; var withHoldingAmount; var noOverTimePay; var noOverTimeGrossPay; var noOverTimeWithHoldingAmount; var noOverTimeNetPay; var netPay; var totalPay; totalPay = ZERO; //Open Payroll Records var employeeInformation = openEmployeePayrollRecords(); //Create table to display results document.write("Employee\t" + "Employee\t" + "Gross\t" + "Withholding\t" + "Net\n"); document.write("Number\t\t" + "Name\t\t" + "Pay\t" + "Amount\t\t" + "Pay" + "\n\n"); //Look at each record and display information while (employeeInformation.readNextRecord()) { employeeNumber = employeeInformation.getEmployeeNumber(); employeeName = employeeInformation.getEmployeeName(); employeeWage = employeeInformation.getEmployeeHourlyWage(); employeeHours = employeeInformation.getEmployeeHoursWorked(); //Calculations regularPay = employeeWage * THIRTY_FIVE; overTimeHours = employeeHours - THIRTY_FIVE; overTimePay = overTimeHours * (employeeWage * ONE_AND_HALF); grossPay = regularPay + overTimePay; noOverTimeGrossPay = employeeWage * employeeHours; noOverTimeWithHoldingAmount = noOverTimeGrossPay * FIFTEEN_PERCENT; withHoldingAmount = grossPay * FIFTEEN_PERCENT; netPay = grossPay - withHoldingAmount; noOverTimeNetPay = noOverTimeGrossPay - noOverTimeWithHoldingAmount; totalPay = totalPay + noOverTimeGrossPay + overTimePay; if (employeeHours > 35) { document.write(employeeNumber + "\t\t" + employeeName + "\t" + grossPay + "\t" + withHoldingAmount + "\t\t" + netPay + "\n"); } else { document.write(employeeNumber + "\t\t" + employeeName + "\t" + noOverTimeGrossPay + "\t" + noOverTimeWithHoldingAmount + "\t\t" + noOverTimeNetPay + "\n"); } } document.write(totalPay); }
  12. fab5freddy

    Basic jquery ?

    Thanks so much for the help things worked great. I've now run into another problem. I have to use a database to find gross amount of pay, withholding amount, net pay, employee number, and employee name. Once the whole program is run I have to find the total of the gross pay the only problem is there is two separate gross amount one for regular pay if hours are 35 or below and than overtime pay for hours over 35. I have everything working fine I just can't figure out how to get the total for all gross pay. Here is my code let me know if there is any clarification that is needed. I'm sorry it may look messy I am very new to this and appreciate any help at all. /* This is the JavaScript code for "Employee Payroll" File: /unit4/project/project4Part2.html */ function project4Part2() { // Your code goes in here. //Constant Variables var ZERO = 0; var THIRTY_FIVE = 35; var ONE_AND_HALF = 1.5; var FIFTEEN_PERCENT = .15 //Variables var employeeNumber; var employeeName; var employeeWage; var employeeHours; var regularPay; var grossPay; var overTimePay; var overTimeHours; var withHoldingAmount; var noOverTimePay; var noOverTimeGrossPay; var noOverTimeWithHoldingAmount; var noOverTimeNetPay; var netPay; var counter; //Open Payroll Records var employeeInformation = openEmployeePayrollRecords(); counter = ZERO; //Create table to display results document.write("Employee\t" + "Employee\t" + "Gross\t" + "Withholding\t" + "Net\n"); document.write("Number\t\t" + "Name\t\t" + "Pay\t" + "Amount\t\t" + "Pay" + "\n\n"); //Look at each record and display information while (employeeInformation.readNextRecord()) { employeeNumber = employeeInformation.getEmployeeNumber(); employeeName = employeeInformation.getEmployeeName(); employeeWage = employeeInformation.getEmployeeHourlyWage(); employeeHours = employeeInformation.getEmployeeHoursWorked(); //Calculations noOverTimeGrossPay = employeeWage * employeeHours; regularPay = employeeWage * THIRTY_FIVE; overTimeHours = employeeHours - THIRTY_FIVE; overTimePay = overTimeHours * (employeeWage * ONE_AND_HALF); grossPay = regularPay + overTimePay; noOverTimeWithHoldingAmount = noOverTimeGrossPay * FIFTEEN_PERCENT; withHoldingAmount = grossPay * FIFTEEN_PERCENT; netPay = grossPay - withHoldingAmount; noOverTimeNetPay = noOverTimeGrossPay - noOverTimeWithHoldingAmount; if (employeeHours > 35) { document.write(employeeNumber + "\t\t" + employeeName + "\t" + grossPay + "\t" + withHoldingAmount + "\t\t" + netPay + "\n"); } else { document.write(employeeNumber + "\t\t" + employeeName + "\t" + noOverTimeGrossPay + "\t" + noOverTimeWithHoldingAmount + "\t\t" + noOverTimeNetPay + "\n"); } } }
  13. fab5freddy

    Basic jquery ?

    Recently in my javascript class we started working a little bit with jquery and getting information from databases. I have the very very basics down such as retrieving the records. However I missed a few days of class and now am unsure how to find the totals, averages and other basic math functions. In the program I am writing I have to display the item number, description and stock amount. I have that just find but can not find anywhere that tells me how to find the total and the average. I have a few variables but everything I've tried doesn't work. I thought it might be something with SQL but not sure. Here is my code so far: function lab05recordSetProcessing() { // Declare Variables var currentNumber; var currentDescription; var currentStockAmount; var totalInventory; var averageInventoryItems; var itemRecords; // Open the Inventory Items Records and make them // available to the script itemRecords = openInventoryItemsRecords(); document.write("The Inventory Items Record Set:<br /><br />"); // Read the next record, test to see if there // is a next record and then output it while (itemRecords.readNextRecord()) { currentNumber = itemRecords.getItemNumber(); currentDescription = itemRecords.getItemDescription(); currentStockAmount = itemRecords.getItemStockAmount(); document.write(currentNumber + "\t" + currentDescription + "\t" + currentStockAmount + "<br />"); } }
  14. fab5freddy

    Adding Numbers

    That worked perfect. I now have to do the same thing with multiplication in a for statement and can not get it to work. Here is the code I have so far. I basically copied everything from the one before but just changed it a little bit. Changing the += to a *= makes it work in the while loop. However in the for loop I can not get it to work. Thanks again for help with the first part. function exercise8part2() { // PART 2: YOUR CODE STARTS AFTER THIS LINE //Variables var firstUserEnteredNumber; var secondUserEnteredNumber; var counter; var userEnteredTotal; //User Input firstUserEnteredNumber = prompt("Enter a number: "); secondUserEnteredNumber = prompt("Enter another number: "); //Assignments firstUserEnteredNumber = Number(firstUserEnteredNumber); secondUserEnteredNumber = Number(secondUserEnteredNumber); //Output for (counter = firstUserEnteredNumber; counter < secondUserEnteredNumber; counter++) { userEnteredTotal = firstUserEnteredNumber *= counter; document.write(counter + " * "); } document.write(secondUserEnteredNumber + " = " + userEnteredTotal); }
  15. fab5freddy

    Adding Numbers

    This is a very basic question I need to find the sum of all numbers based on what the user inputs. For example if the user inputs 5 and 10 I need to come up with an answer of 45. 5 + 6 + 7 etc. all the way to and including 10. I have a start to the statement but am unsure where to go from there. I am just starting to learn javascript, so if you need more information just let me know. Here is me code: function exercise7Part2() { //Variables var firstUserEnteredNumber; var secondUserEnteredNumber; var counter; var userEnteredTotal; //User Input firstUserEnteredNumber = prompt("Enter a number: "); secondUserEnteredNumber = prompt("Enter another number: "); //Assignments firstUserEnteredNumber = Number(firstUserEnteredNumber); secondUserEnteredNumber = Number(secondUserEnteredNumber); counter = firstUserEnteredNumber; //Output while (counter < secondUserEnteredNumber) { document.write(counter + " + "); counter++; } document.write(secondUserEnteredNumber + " = " + userEnteredTotal); }
×