Git Product home page Git Product logo

unit-0's People

Contributors

ahhhlvin avatar alexhsamuel avatar asaini avatar bucimis avatar davisroman avatar gwgundersen avatar jrodbx avatar lukesterlee avatar malinatran avatar noidontdig avatar yuliya-kaleda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unit-0's Issues

HW due 3/20

1. Divisor Pattern Art

Print a table of size NxN where an entry (i, j) is:

  • @ @ character + 1 space character if i divides j or j divides i
  • Two empty space characters, otherwise

For example:

@ @ @ @ @ 
@ @   @   
@   @     
@ @   @   
@       @ 

2. Twenty Questions Game

Write a program which assumes a random integer X in some range, say 1 - 100,000. It prompts you to input a number and responds with the following information:

  • Input number is higher than X
  • Input number is lower than X
  • Input number is equal to X, in which case you win the game
    Your program gives 20 chances to guess the number and you lose if you fail to guess.

You can use Java's Math.random() to generate a random number. Note that it returns a double, but we want an int

3. Fibonacci

The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...
Write a program which accepts as input an integer N and returns the N-th Fibonacci number. To test whether your program returned the correct number, go to Wolfram Alpha, and enter fibonacci(N) where N is your input integer

4. A Pretty Title

Write a program that calls a method printTitle that prints a phrase as a title by,

  1. converting it to title capitalization
  2. underlining each word, i.e. underlying all characters except spaces

For example,

printTitle("a tale of two cities", '*')

produces

A Tale of Two Cities
* **** ** *** ******

5. Who is more verbose : Dickens or Melville?

Fork the repo VerbosityCalculator and follow the instructions in the repo

6. Weekly requirements

7. Submission

Post a link to your homework GitHub repositories + link to your Medium post as comment to this issue by Friday 3/20 8pm.

Submission format: : Same as last week

Bonus Challenges! (optional)

Exercise: [optional] Write a method that counts the number of words in a string. For example,

coundWords("Eighty percent of success is showing up.")

returns 7.

Exercise: [optional] Write a method that computes the average word length. To compute the average, count the total number of letters in words (not including spaces) as well as the total number of words, and divide them. Make sure the result is a double, not an int. For example,

averageWordLength("Eighty percent of success is showing up.")

returns about 4.714.

Execise: [optional] Write a method that replaces all occurrences of "man" with "wo/man", "men" with "wo/men", "he" with "s/he", "his", with "his/her", and "him" with "him/her". Feel free to substitute your own preferred gender-neutral nouns and pronouns.

Exercise: [optional] Write a method that reverses a string by order of words (rather than characters). Treat punctuation as part of a word.

For example,

reverseWords("You miss 100% of the shots you don’t take.")

returns

"take. don't you shots the of 100% miss You"

For extra credit, try to preserve sentences by leaving punctuation at the end and fixing capitalization, so that the result is instead,

"Take don't you shots the of 100% miss you."

HW due 3/27

Welcome to HW3! All material used in this HW is located here

1. Recap: Strings and loops

Write a function uniqueCharacters which accepts as input a string S. Given the string S return a string S2 which contains all the distinct characters in S. The input string will only contain lowercase characters. The ordering of characters in the output string does not matter. Eg.

  • abbcaabcaa --> abc
  • apple --> aple or aepl
  • microsoft --> microsft

2. Java Classes

You are provided with a Person class. This class has private fields name, phoneNumber and city, along with their getter and setter methods.

  • Write a function called checkSameCity which accepts as input two Person instances and checks if they live in the same city. The function should return a boolean value
  • A Person has recently had a child, whose name is 'Abc'. Write a function called registerChild which accepts as input a Person instance(Parent) and returns a new Person instance for the child, which has the same phoneNumber and city as the parent.

3. Cryptography : Caesar Cipher

The Roman General Julius Caesar used to correspond with his generals using a secret code. He devised a way of encrypting his messages using a simple encryption scheme now known as Caesar Cipher or Shift Cipher. You can read more about it here

  • You are given a class called CaesarCipher with static methods encode and decode
  • Being amateur codebreakers, we want to know if two distinct looking ciphers correspond to the same input message. Write a function called codeBreaker, which accepts two cipher strings and returns a boolean value which tells us whether they are actually the same input message encoded using two different offsets.
  • There are multiple ways to do this. Try to come up with as many solutions as you can.

4. BONUS : Voting System

You are given 3 classes

  • ElectionManager
    • Conducts an election.
    • Controls start of voting
  • Election
    • Maintains a list of contenders
  • Contender
    • Represents details about a contender
      • What is the contender's name?
      • How many votes has he received?

Write a program to simulate an election. Create a class called VotingSimulator. In the main method, you are required to do the following:

  1. Create an Election object, and given the Election a name
  2. Create a few Contender objects. Add these to the Election object. Make sure that the contender names are distinct!
  3. Create a ElectionManager object. Ask it to manage the Election object created above.
  4. Ask the ElectionManager to initiatePolling
  5. Follow the instructions on the console. After each round of polling you will be asked(within the console) whether you want to continue or not.
  6. Ask the ElectionManager to displayResults

5. Weekly Requirements

After submitting your HW, please complete a HW Feedback form

HW due 4/3

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

Eg. if arraylist contains: [3, 45, 1, 2, 99] and x = 1
Returns : 2

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:

a = 14.44 %
b = 6.02 %
...
...
z = 0.05 %

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

HW due 3/13

1. Text based game

Finish your Text based game, using loops and methods.

2. Roman numeral calculator

Finish your Roman Numeral Calculator.

3. Weekly requirements

4. Submission

Post a link to your homework GitHub repositories + link to your Medium post as comment to this issue by Friday 3/13 8pm.

Submission format:

1. [Adventure Game](<link to homework repository>) // should be named HW-20150314
2. [Roman Numeral Calculator](<link to homework repository>)
3. [Medium post](<link to Medium post>)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.