Question: electrical science Question 9 (1 point) public class Voter string name; string party public Voter (String name, string party) this.name name; this.party = party; public

 electrical science Question 9 (1 point) public class Voter string name;

electrical science

Question 9 (1 point) public class Voter string name; string party public Voter (String name, string party) this.name name; this.party = party; public void setName (string name) { this. name name; } public void setParty (String party) I this.party party: Look at the class definition above. Then write a few lines of Java code that will 1. Create a new Voter object, with the following information the name should be "Joe Bob" the party should be "Independent" 2. Add that to an ArrayList named voters Keep it simple. Assume the ArrayList has already been defined and allocated. Just create a new Voter, with the specified values, and add it to the voters list. There's more than one way to do this but it shouldn't take more than 4 lines of code. No print statements, scanner calls, no writing a whole class. Just 1-4 lines of code

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!