Scenario/requirements:

You have been selected by the United States Senate to create a Java solution for managing the voting on motions once debate has concluded on the senate floor.

The code you create must accept yes and no votes on various motions and determine whether each motion passes or fails.

  • A motion must not accept any votes until it is opened for voting. When a motion is closed for voting, a result is returned that describes
    • whether the motion passed or failed
    • the number of yes and no votes
    • the time that voting opened and closed
  • A motion cannot be closed for voting less than 15 minutes after it was opened.
  • No voter can vote more than once on the same motion.
  • The maximum votes that can be received on a motion is 101 (100 senators plus the Vicepresident).
  • If voting is a tie, then an attempt to close the motion for voting will cause it to enter a special tied state.
    • In the tied state, the Vice-president of the United States is the only person allowed to vote on the motion. Once the VP votes, the motion is automatically closed.
    • The VP is only allowed to vote on motions that are in the tied state.
    • If the VP is not available to vote, then voting can be forced to the closed state which causes the motion to fail.
  • The code must support a query to discover the current state of a motion.

Instructions:

To successfully complete the assignment, follow these instructions:

  • Write Java classes that meet all requirements
  • Write JUnit tests to verify all requirements
  • DO NOT write any UI code or service code, only domain code
  • DO NOT write any persistence code or authentication code
  • Avoid use of any framework or open source library other than Junit
  • Readability and maintainability of your code is key
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.