Skip to content
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 3/27 #5

Open
asaini opened this issue Mar 21, 2015 · 33 comments
Open

HW due 3/27 #5

asaini opened this issue Mar 21, 2015 · 33 comments

Comments

@asaini
Copy link
Contributor

asaini commented Mar 21, 2015

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

@Yuliya-Kaleda
Copy link
Contributor

@lukesterlee
Copy link
Contributor

  1. Homework

@jgarcia162
Copy link

@sufeiiz
Copy link

sufeiiz commented Mar 27, 2015

  1. Homework
  2. Occam's Razor

@hanzchoi
Copy link

@Amcbri15
Copy link

Homework Repo
Medium Post

@jaellys
Copy link

jaellys commented Mar 27, 2015

  1. Homework -- may add bonus soon.
  2. In Case of Emergency: BnB. -- I'm one off on the Medium posts, will get it in ASAP.

@ahhhlvin
Copy link
Contributor

Homework
Medium Post

@KMaragh
Copy link

KMaragh commented Mar 27, 2015

Homework
Medium Post --Will add soon

@fattyduck
Copy link

HW //I have finally found the issue and remade a repo without the other files
Medium

@abassawo
Copy link

  1. Homework
  2. Medium Story Coming Soon

@hyunj0
Copy link

hyunj0 commented Mar 27, 2015

HW_03-27
Medium

@poojawins
Copy link

  1. Homework_03_27

@GMSyrimis
Copy link

Homework
Medium

@alizinha
Copy link

@m47bell
Copy link

m47bell commented Mar 27, 2015

Homework

Medium Post

@ramonaharrison
Copy link

  1. Homework
  2. Blog post

@noidontdig noidontdig reopened this Mar 27, 2015
@MadelynTav
Copy link

Homework
Medium Post

@hoshikoo
Copy link

  1. Homework
  2. Medium

@lighterletter
Copy link

Homework
Medium

@AnthonyFermin
Copy link

  1. Homework Repo
  2. Medium Post

@eboves
Copy link

eboves commented Mar 28, 2015

  1. HomeWork
  2. Medium Post

@tashsmit
Copy link

  1. Homework
  2. Medium Post

@hanzchoi
Copy link

4.Medium post

@jvvlives2005
Copy link

  1. Homework
  2. Medium

@charlyn23
Copy link

  1. Homework

@RosmaryFC
Copy link

  1. Homework
  2. Medium Post

@theaulait
Copy link

  1. Homework
  2. Medium Post

@rayacevedo45
Copy link

  1. Homework

@ReinardCox
Copy link

@annalinewyork
Copy link

Homework
Medium post

@jorgereina1986
Copy link

Homework
Medium

@JLWork3
Copy link

JLWork3 commented Apr 14, 2015

Homework
Medium Post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests