Question: Java Program to code a Vote algorithm - Given votes of candidates sort them by most votes received. Design a ranked-choice voting system. A single

Java Program to code a Vote algorithm - Given votes of candidates sort them by most votes received.

Design a ranked-choice voting system. A single person votes by handing in an ordered array of names like : ["alice", "bob", "charlie", "dan"...] Part 1 Candidates are given 3 points for 1st place, 2 points for 2nd and 1 point for 3rd place. Given an array of arrays of names, return the candidates in order of most points to least. Part 2 In the event of a tie, return the candidate who reached the winning points first

READ BEFORE ANSWERING:

The Code should be complete without any errors and should execute.

Incomplete code or code with erros and logical problem will get a downvote.

First vote have highest weight and subsequent votes have weight-1 then previous vote

Input : [[A, B, C

A, C, D

D,A,C]]

Output : [A, D , C , B]

Consider the following:

1] Use the Design principles and design patterns in the code

2] Write Executable code with Junit Tests and Console Tests.

3] How can we use this code in concurrent environment?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!