In this exercise you will create a simple votingmachine in


In this exercise you will create a simple VotingMachine. In the United States, when a candidate runs for office, the person is often identified as a Democrat, Republican, or Independent. Write a Java class (VotingMachine.java) which allows one to vote by party affiliation and will also allow us to query the number of votes for each party and who won the election. The behavior is given below:

VotingMachine vm = new VotingMachine();

vm.voteDemocrat();

vm.voteDemocrat();

vm.voteRepublican();

vm.voteIndependent();

vm.countDemocrat(); // returns 2

vm.countRepublican(); // returns 1

vm.countIndependent(); // returns 1

vm.whoWon(); // returns "Democrat"

 

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: In this exercise you will create a simple votingmachine in
Reference No:- TGS01085049

Expected delivery within 24 Hours