211k views
3 votes
Creating Classes

Create a class that will keep track of a yes/no survey. You will have to store the text (question) of the survey plus the number of yes/no votes. The constructor requires a description of the survey to be passed int (the question). The vote method will simply increment the correct vote count. The toString method will format all of the instance data to be displayed on the screen

User Giorgian
by
5.0k points

1 Answer

1 vote

Answer:

Step-by-step explanation:

The following code was written in Java. The class created is called Survey. In the constructor it takes in the question in order to create the survey object. The vote method, asks the user for a yes/no response and saves it. Finally, the toString method prints the question and the number of each vote to the screen. Due to technical difficulties I have added the code as a txt file attached below.

Creating Classes Create a class that will keep track of a yes/no survey. You will-example-1
User UTeisT
by
6.4k points