Write a java class which allows to vote by party affiliation

Assignment Help JAVA Programming
Reference no: EM131320984

Assignment

MUST BE DONE ON BLUEJ

In this exercise you will create a simple VotingMachine. In the United States, when a candidate runs for office, the person is often identified as a Democrat, Republican, or Independent. Write a Java class (VotingMachine.java) which allows one to vote by party affiliation and will also allow us to query the number of votes for each party and who won the election. The behavior is given below:

VotingMachine vm = new VotingMachine();

vm.voteDemocrat();

vm.voteDemocrat();

vm.voteRepublican();

vm.voteIndependent();

vm.countDemocrat(); // returns 2

vm.countRepublican(); // returns 1

vm.countIndependent(); // returns 1

vm.whoWon(); // returns "Democrat"

For simplicity, you may assume that there will be no ties in this election.

Create a new project in BlueJ by clicking on the menu option Project > New project. This will create a folder with the project name (see below). All BlueJ project-related files for this project will be stored in this folder. Create new classes by clicking on the [New Class] button. All Java class files that you create (.java files) will be stored in the BlueJ project folder. The project folder will contain other files as well. After completing and testing your assignment, zip the entire BlueJ folder and submit it. Since your Instructor will need all files in the project folder, make sure you zip the entire folder. For this assignment the names of the BlueJ project, Java class files, and the zip file you submit are given below:

BlueJ project: voting_machine

Java files: VotingMachine.java

Submit the full zipped BlueJ project folder: voting_machine.zip

Reference no: EM131320984

Questions Cloud

Targeting and growing the female market segment : Should under amour continue targeting and growing the female market segment? Or should it target a broader population to gain more traction on Nike and get closer to the number one spot?Should Under Armour keep paying famous athletes to be part of..
When do researchers use regression analysis : Distinguish among simultaneous (or standard), stepwise, and hierarchical regression.
Develop an action plan for creating your personal brand : Describe what you want your personal brand to be. In the next step, you develop an action plan for creating or enhancing your personal brand. Provide at least one clear example of an experience in this course that has helped, or may help, you move to..
What line is described by a regression equation : Write the general form of a regression equation that has a single predictor variable. Identify the criterion variable, the predictor variable, the regression constant, and the regression coefficient.
Write a java class which allows to vote by party affiliation : Write a Java class (VotingMachine.java) which allows one to vote by party affiliation and will also allow us to query the number of votes for each party and who won the election.
What is the after-tax holding-period return on the bond : A newly issued bond pays its coupons once annually. Its coupon rate is 5%, its maturity is 20 years, and its yield to maturity is 8%, and its face value is $1,000. Find the holding-period return for a 1-year investment period if the bond is selling a..
Write the pseudo code for the main program logic : When a user specifies a price, find any seat with that price and give feedback on the seat row and number and mark the seat as "SOLD". Repeat the process until the user exits the program. Write the pseudo code for the main program logic.
Which is worse--confound variance or error variance why : What are order effects, and how does counterbalancing help us deal with them?
Strategic decision partnering with the brotherhood : Did vineyard vines make a good strategic decision partnering with the brotherhood of the traveling plants?  How should vineyard vines proceed with its social media strategy?Was vineyard the right partnership for the brotherhood?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Distance traveled modification

Distance Traveled Modification

  Eplain the main purpose of using javascript on a website

question 1 what is the purpose of using javascript on a website? what is a specific example of a javascript

  Develop a program that plays craps with a player three times

Write a program that plays the Rock-Paper-Scissors-Lizard-Spock game. Refer to http://en.wikipedia.org/wiki/Rock-paper-scissors-lizard-Spock for more information - Develop a program that plays craps with a player three times. At the end, the progr..

  All your code should be in the main method

Write a Java test program, all your code should be in the main method, that asks the user for two numbers representing an investment value and interest rate

  Negatively impacting health care currently

Identify and explain at least two events that are negatively impacting health care currently. Tell us why you think these items are negatively impacting the access to care, and make sure that you cite your references.

  On any given execution your program

On any given execution your program will produce just one version of the figure. However, you should refer to the class constant throughout your code, so that by simply changing your constant's value and recompiling, your program would produce a f..

  Qr codes are a popular way

QR codes are a popular way to encode data for easy reading by computerized cameras. True QR codes contain error correction, format specifiers, version information, and a size variable layout that makes them harder to decode and process

  Create a graphical application stackdemogui

Create a graphical application StackDemoGUI that provides a button for push and pop from a stack, a text field to accept a string as input for push, and a text area to show the contents of the stack after each operation.

  Perform an internet search

Perform an Internet search for Java® applets. Explore various websites that feature free Java® applets. Write a 400- to 500-word paper, addressing the following:

  Where the computer stores the list of exceptions

The call stack is where the computer stores the list of exceptions. Overloaded methods have the same name and parameter lists

  Integer expression evaluator

You must implement a bounded generic Stack class. Represent your Stack using an array to hold the stack content - Integer Expression Evaluator

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd