Question
Create a stored Procedure called PreferenceDistribution() The result should count the number of votes casted, if the candidate got more than 50% of the vote,
Create a stored Procedure called PreferenceDistribution()
The result should count the number of votes casted, if the candidate got more than 50% of the vote, it should win the election. The round should be based on how many the candidates are competing. Lets assume there are (n) number of candidates, then there should be (n-2) rounds.
The stored procedure should show the number of round, the name of the candidates, and how many votes they got on the round, the candidate with least vote will be eliminated and the number of votes the eliminated candidate has will be redistributed to the candidate that are still standing based on the preferences.
ID PREF1 123 Amy Wong 234 Sam Andrew 345 Sam Andrew 456 Philip Will 567 Amy Wong ELECTIONS ELECTION ID STATE 20 California 21 Florida 22 Utah 23 Colorado PREF2 Judson Mack Amy Wong Amy Wong Amy Wong Judson Mack CAST VOTING PAPER PREF3 Sam Andrew Fanny Thrung Fanny Thrung Sam Andrew Sam Andrew Prefrence Distribution() ROUND 1 Amy Wong Sam Andrew Philip Will Judson Mack Fanny Thrung PREF4 Fanny Thrung Judson Mack Philip Will Judson Mack Fanny Thrung ROUND 2 Amy Wong Sam Andrew Philip Will 22 PREF5 Philip Will Philip Will Judson Mack Fanny Thrung Philip Will 1 O ELIMINATED O ELIMINATED 5 -- 2+3 2--2+0 1 ELIMINATED ELECTIONID 23 23 23 23 23 (Amy got more than 50%, Amy Wins)
Step by Step Solution
3.36 Rating (149 Votes )
There are 3 Steps involved in it
Step: 1
1 Procedure SSSENH 2 3 4 Step 11 6 PreferenceDistribution Expl...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started