-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HW due 4/3 #6
Comments
Hello Asaini! for HW problem 1, how are we getting the ArrayList? Should we pass that through the method parameter as well as the integer x? |
Hi Asaini, I also have a question :) I'm wondering about problem #3, where it says "You can ignore characters which do not belong in the range(a-z)"... does this mean we should ignore the uppercase variants of those characters (A-Z), or would you prefer that we account for all alphabetic characters in the text? |
Hi tashsmit & ramonaharrison, I've updated the descriptions for Problems 1 & 3. Problem 1 : You are required to pass the ArrayList as a parameter to the search method . Thanks |
HW//will add medium post on friday |
|
|
|
Homework |
*Finished Distribution Calculator. Hw |
Welcome to HW4! This homework is due on Friday, 4/3 by 8 pm.
1. Linear Search on ArrayList
You are given an ArrayList of unknown size containing integers. Write a class called LinearSearch which implements a static method search which accepts as input an ArrayList alist and an integer x, and returns the first index it sees of x in alist. If the integer is not present return in the list return -1
2. Sanitizing web pages
Search engines like Google have programs called web-scapers which visit webpages and scrape the information displayed on the webpage. The displayable information is contained in html tags like p, table, h2 etc. When we make a GET request for a webpage, the HTML that is returned can also contain tags like script which often do not correspond to the displayable content on the webpage. Information inside script tags is not used by scapers and they often ignore these tags in the HTML. Write a class called WebPageSanitizer which implements a static method called String sanitize(String html) which removes all script tags and the information that they encapsulate and returns a sanitized version of the HTML string.
3. Character Distributions
Create a class to calculate the distribution of characters in the contents of a text file. Your class called DistributionCalculator should implement a method calculate(File textFile) which accepts as input a Text file. It reads the contents of the file and returns an ArrayList which contains the distribution/percentage of characters (a-z) in the text file. You should lowercase lines before you do the calculation. Call the calculate method from main and print the distribution. You can ignore characters which do not belong in the range(a-z) for doing your calculation. Your program's output should look something like:
4. Bonus/Challenge : Project Euler
Project Euler is a website dedicated to a series of computational problems intended to be solved with computer programs. The project attracts adults and students interested in mathematics and computer programming.
As an exercise, we are asking you to solve one of Project Euler's problems described here. Create a class called LettersInNumbers which has a method letterCount which returns an integer containing the number of letters.
5. Weekly Requirements
After submitting your HW, please complete a HW Feedback form
The text was updated successfully, but these errors were encountered: