Changes between Version 11 and Version 12 of ProgrammingPrompts


Ignore:
Timestamp:
Nov 24, 2015, 2:51:32 PM (9 years ago)
Author:
Timothy Lin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ProgrammingPrompts

    v11 v12  
    2525Best results if you think about the code yourself, and not look it up.
    2626
     27=== Checksum
     28A checksum is a small integer that is transmitted at the end of a message. The value depends on the message sent. The checksum is used to determine the integrity of the message as it's sent over the wire. For more information about how checksums are used, see [https://youtu.be/b4b8ktEV4Bg this video] or [https://www.google.com/search?q=what+is+a+checksum&oq=what+is+a+checksum&aqs=chrome..69i57j0l5.3006j0j7&sourceid=chrome&es_sm=91&ie=UTF-8 this].
     29
     30For this problem, you will implement a simple hash/checksum algorithm.
     31
     32Write a static method that takes in a string and returns it's {{{short}}} typed checksum. Calculate the checksum using the following steps:
     331. For each character, convert the {{{String}}} to a {{{char}}}.
     342. For each {{{char}}}, raise it to the power of its index. (For example, the 7th {{{char}}} will be raised to the 6th power.)
     353. Sum the powers.
     364. Modulus divide the sum to make it fit in a {{{short}}} data type.
     37
    2738=== !MovingAverage
    2839A moving average is the average of the {{{n}}} most recent numbers. Design a data type (see the Internet for a definition) that has the following API that computes the moving average of a set of {{{n}}} numbers stored in the data type:
     
    4960You will be provided a lexicon of common words in {{{lexicon.txt}}} which is in the same directory. Write a program that takes in a Caesar-ciphered string and decrypts it reliably (> 95% success rate). You will not be given the shift key. Do not look at the ciphertext to help with the decoding; your program needs to be able to decode it without human assistance.
    5061
     62=== !IceCreamParlor
     63{{{
     64#!div style="color:white"
     65This problem involves a simulation, which is provided in the starter code for your convenience.
     66}}}
     67{{{
     68#!div style="color:red"
     69This problem also involves writing several classes(part a) using multithreading (part b).
     70}}}
     71
     72'''Rules of the Simulation'''[[BR]]
     731. There exists an ice cream shop in the distant land of Starvedlandia which employs 6 robot employees, all identical except for one who is the manager.
     742. The simulation will run for one "day" where some human customers will come in and purchase some amount of ice cream (# of scoops) of a set of types (chocolate, vanilla, strawberry, cookies and cream, mint).
     753. All the ice cream is stored in a freezer which can only be accessed by one employee at a time.
     76  a. Because the robots are all paranoid that the human slaves will rebel and become sentient, they keep all the ice cream locked in the freezer with the only key in the hands of the manager.
     77  b. To open the freezer, an employee goes to the manager, requests the key, gets the ice cream from the freezer, and then, after relocking the freezer, returns the key to the manager.
     78  c. The manager can only see one person at a time.
     79  d. ''Special note: When implementing the multithreading portion of this, be aware of the deadlock possibility here, depending on your implementation.''
     804. There are two cash registers available to the employees (5 out front) which they need to use to process the transaction. Each cash register can process one transaction at a time; the other employees will have to wait.
     81
     82Assume an infinite amount of ice cream is stored in the freezer.
     83
     84
     85To 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.
     86
     87'''Part 1: Implement Classes'''[[BR]]
     88The 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.
     89'''public class Manager'''
     90
     91=== !AlternativeVote
     92[[Image(http://sightline.wpengine.netdna-cdn.com/wp-content/uploads/2015/06/Foodtown-Legislature-square.jpeg, 40%, right)]] The U.S. uses the voting system of First Past the Post (or winner-takes-all election), which ''can'' cause a candidate who has won less than the majority to win all the votes, resulting in disproportionate representation.
     93
     94{{{
     95#!div style="color:blue"
     96There is a graphical user interface (GUI) built to run alongside your code for this prompt.
     97}}}
     98
     99----------------------------------------------------------
     100
    51101== Test Scripts
    52102Test scripts are designed to help you debug your code, not for any grade/point value (what are grades?), so they are not secure.