Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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!
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 "yesStep by Step Solution
There are 3 Steps involved in it
Step: 1
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