Changes between Version 19 and Version 20 of ProgrammingPrompts


Ignore:
Timestamp:
Nov 25, 2015, 10:55:29 PM (9 years ago)
Author:
Timothy Lin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ProgrammingPrompts

    v19 v20  
    3333Write a static method that takes in a string and returns it's {{{long}}}-typed checksum. Calculate the checksum using the following steps:
    34341. For each character, convert the {{{String}}} to a {{{char}}}.
    35 2. For each {{{char}}}, raise it to the power of its index. (For example, the 7th {{{char}}} will be raised to the 6th power.)
     352. For each {{{char}}}, raise it to the power of its index+1. (For example, the 7th {{{char}}} with index 6 will be raised to the 7th power.)
    36363. Sum the powers.
    37374. Allow overflow.
     
    8585To recap and clarify, a customer comes in wanting to buy ice cream and approaches an employee (not the manager); the employee must learn how much and what type of ice cream the customer wants. To get the ice cream, they need to go to the manager, get the key, go to the freezer, get the ice cream, and return the key to the manager. Then the employee needs to find an open cash register to finish the transaction.
    8686
    87 '''Part 1: Implement Classes'''[[BR]]
     87===== Part 1: Implement Classes[[BR]]
    8888The following classes will be essential to be implemented. You may decide other classes are necessary. It is recommended to build from the starter code, and not modify it.[[BR]][[BR]]
    8989'''public class Manager'''
     90
     91
     92[[BR]]
     93'''public class Freezer'''
     94
     95
     96[[BR]]
     97'''public class Employee'''
     98
     99
     100[[BR]]
     101'''public class Customer'''
     102
     103
     104[[BR]]
     105'''public class Cash Register'''
     106
     107
     108===== Part 2: Implement the Simulation
     109
    90110
    91111=== !AlternativeVote
     
    93113
    94114A reasonable alternative to this system, which would discourage the spoiler effect, is the alternative vote, also known as instant-runoff voting. Read more about the alternative vote [https://en.wikipedia.org/wiki/Instant-runoff_voting here] and/or watch [https://youtu.be/3Y3jE3B8HsE this video] explaining the process (more fun).
    95 
    96 Implement a ballot counter for the alternative voting system. You will write a class that will be given a list of {{{Vote}}} objects (defined below) and must process them and determine any winners.
    97 
    98115{{{
    99116#!div style="color:blue"
    100117There is a graphical user interface (GUI) built to run alongside your code for this prompt.
    101118}}}
    102 
     119Implement a instantaneous (live) ballot counter for the alternative voting system. You will write a class that will be given a list of {{{Vote}}} objects (defined below and declared in the code) and must process them and determine any winners along the way.
     120[[BR]][[BR]]
     121'''public enum Party'''
     122{{{
     123#!div
     124ALEXANDRIAN_PARTY, NATHANS, ANDIAN PARTY
     125}}}
     126'''public enum Candidate'''
     127{{{
     128#!div
     129ALEX, NATHAN, ANDREW, JACOB, ARDEN
     130==== public void setParty(Party)
     131}}}
     132Candidates' parties are variable and determined at runtime.
     133[[BR]][[BR]]
     134'''public class Vote'''
     135==== public Party getParty()
     136==== public Candidate getCandidate()
    103137
    104138== Test Scripts