007-001-006
Class Creation: Survey Counter
Easy
Problem Description
class Creation: Survey Counter
In this problem, you will create a program that stores agree/disagree vote counts in a class, calls aggregation methods, and displays the results to standard output.
Learning Objective: Create simple class and call methods
Create a class that tallies survey results. Implement methods to count agree/disagree responses.
Input
Line 1: Number of agree (integer)
Line 2: Number of disagree (integer)
Output
Agree: [count] votes
Disagree: [count] votes
Total: [count] votes
Examples
Example 1: 30 and 20 votes
Input:
30
20
Output:
Agree: 30 votes
Disagree: 20 votes
Total: 50 votes
Example 2: 45 and 15 votes
Input:
45
15
Output:
Agree: 45 votes
Disagree: 15 votes
Total: 60 votes
Example 3: 0 and 0 votes (boundary)
Input:
0
0
Output:
Agree: 0 votes
Disagree: 0 votes
Total: 0 votes
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up