Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. let numberOfItems = 0;
  2. let itemIndex = 0;
  3. let itemNum = 0;
  4. let counter = 0;
  5. while (numberOfItems < 10) {
  6. numberOfItems = prompt("Enter the number of items in the auction (must be >= 10)")
  7. }
  8.  
  9. const itemCode = [];
  10. const itemDescription = [];
  11. const itemReservePrice = [];
  12. const itemHighestBid = [];
  13. const itemNumberOfBids = [];
  14. const itemSoldStatus = [];
  15. const itemBuyerCode = [];
  16. for (itemIndex = 1; itemIndex <= numberOfItems; itemIndex++) {
  17. counter = 1;
  18. if (itemIndex === 1) {
  19. itemNum = prompt("Enter the unique item number: ");
  20. }
  21. while (counter < itemIndex) {
  22. if (counter === 1) {
  23. itemNum = prompt("Enter the unique item number: ");
  24. }
  25. if (itemNum === itemCode[counter]) {
  26. alert(`The item number: ${itemNum} already exists!`);
  27. counter = 0;
  28. }
  29. counter++;
  30. }
  31. itemCode[itemIndex] = itemNum;
  32. itemDescription[itemIndex] = prompt("Enter the item description.");
  33. itemReservePrice[itemIndex] = prompt("Enter the item reserve price: ");
  34. itemHighestBid[itemIndex] = 0;
  35. itemNumberOfBids[itemIndex] = 0;
  36. itemSoldStatus[itemIndex] = false;
  37. itemBuyerCode[itemIndex] = 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement