Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need code for the following 1. Copy and paste the Student class code from last week into WK5 Class project. Add two constructors to the

need code for the following
image text in transcribed
image text in transcribed
1. Copy and paste the Student class code from last week into WK5 Class project. Add two constructors to the class: one that takes no arguments and another that takes two arguments. Test your class by creating a Student object called s1 with the constructor that takes two arguments and using its accessor anti mutator methods. 2. Add a Java Class file called Voting Machine.java to WK5Class project. Implement a Voting Machine class that can be used for a simple election. A voting machine has two properties-republican votes and democrat votes Write a constructor that accepts no arguments and sets the votes for both parties to o Write methods (note that none of these methods take any arguments or return any values) void clearl) to reset the votes for each party to 0 void vote Dem that increases the democrat votes by 1 void voteRepl) that increases the republican votes by 1 void print Votest that prints the tallies of the votes for both parties in . this way: Republican Votes: 6 Democrat Votes: 10 Identify the accessor methods (access/read/gets properties) and mutator methods (change/modify/sets properties) Test your class: Create a voting machine object called vm1. Then vote for each party multiple times by calling the vote Red and voteReg methods multiple times and then print the votes received by each party by using the priot Votes method. Then clear the votes by using the clear method and reprint the votes of each party. public class Student { 3 Student (double d, int i, String jack) { throw new Unsupported OperationException } L void printObject() { throw new Unsupported OperationException } void setAge(int i) { throw new Unsupported OperationException(" } void setGpa ( double d) { throw new Unsupported OperationException ("N } 7 8 29 9 30 }

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_2

Step: 3

blur-text-image_3

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

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago