//COMPUTER SCIENCE 161.01 //FRIDAY NOV 8th 2019 //SEQUENTIAL SEARCH (a.k.a. LINEAR SEARCH) //THE PROGRAM BELOW PERFORMS THE SEQUENTIAL SEARCH ALGORITHM //IT IS ALSO KNOWN AS THE 'LINEAR' SEARCH ALGORITHM //BECAUSE IT REQUIRES AT MOST N COMPARISONS WHERE N IS SIZE OF LIST //HERE, N is 15. lastNames = new Array("Purdie", "Gaither", "Turner", "Saenz", "Dawson", "Puhlick", "Valente", "Lively","McCartney", "Lennon", "Eisele", "White", "Harrison", "Flanagan", "Starr"); firstNames = new Array("Boyce", "James", "Chase", "Manuel", "Ben", "Peyton", "Tom", "Justin", "Paul", "John", "Jackson", "Jonathan", "George", "Will", "Ringo"); //THESE TWO ARRAYS ARE CONSIDERED "PARALLEL ARRAYS" i=0; desiredName = prompt("Enter the last name of the person you wish to greet:"); //NOW, LET'S WRITE A LOOP TO GREET THIS PERSON USING HIS FIRST NAME i=0; desiredName = prompt("Enter the last name of the person you wish to greet:"); found = false; //NOW, LET'S WRITE A LOOP TO GREET THIS PERSON USING HIS FIRST NAME while (found == false && i < lastNames.length) { if (lastNames[i] == desiredName) { alert("Happy Monday to " + firstNames[i]); found = true; } else i++; } if (found == false) alert("Could not find " + desiredName);