Question: PROGRAMMING IN JAVA - ASSIGNMENT: JAVA CLASSES Instruction: Give java code for a support class called Vote that allows a user to add yes and

PROGRAMMING IN JAVA -

ASSIGNMENT: JAVA CLASSES

Instruction: Give java code for a support class called Vote that allows a user to add "yes" and "no" votes to some total votes, and allows the user to find out which has the higher number. Code class must contain the constructor and methods specified below!

PROGRAMMING IN JAVA - ASSIGNMENT: JAVA CLASSES Instruction: Give java code for

Give code for a support class called vote that allows a user to add yes" and "no" votes to some total votes, and allows the user to find out which has the higher number More specifically, your class must contain the following constructor and methods: . A constructor of the form Vote (int yesVotes, int noVotes) This constructor sets the initial number of"yes" votes to yesVotes and the initial number of"no" votes to of the point to noVotes public void yeaVote ) This method increments the number of "yes" votes by public void noVote ) This method increments the number of"no" votes by 1 . public String getWinner ) This method should return either "yes" or "no", depending on which has the higher total so far. For example: Vote v= new Vote (2, 1); v.yesVote) v.noVote System.out.println (v.getwinner ) Initially 2 yes" votes and 1 "no" vote Now 3 "yes" votes Now 2 "no" votes Prints "yes

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!