Answered step by step
Verified Expert Solution
Link Copied!

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!

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago