Create a simple votingmachine

Assignment Help JAVA Programming
Reference no: EM13804791

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"

 

Reference no: EM13804791

Questions Cloud

Determine if the problem is either a test of hypothesis a co : Directions: Read the following problem. In your drop box submission, please include the following information: a. Determine if the problem is either a test of hypothesis, a confidence interval or something else and specify the 'key words' found in th..
About global social issue : global social issue
Analyze the major points of george washington''s : For this assignment, you will analyze the major points of George Washington's "Farewell Address" and write a 3-page analysis, considering contemporary government and including differing points of view.
Create a new project in bluej by clicking on the menu option : 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 ..
Create a simple votingmachine : 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
Describe the subject of the painting woman seated in a chair : Discuss "Woman Seated in a Chair" by Picasso, painted in 1941. Describe the subject of the painting, the theme, the period when it was painted.
Examine the organizational structure resulted from merger : Examine the organizational structure that has resulted from the merger or acquisition. Analyze the major differences between the resulting company and the original two organizations.
Backgrounds of korey stringer and eraste autin : Investigative Reporters: Research the backgrounds of Korey Stringer and Eraste Autin. Find out what made them special to their family, friends, coaches, and team mates.
Term paper on language development hypotheses : Term Paper on Language Development Hypotheses

Reviews

Write a Review

JAVA Programming Questions & Answers

  Dijikstra for undirected graph using simple scheme

Dijikstra for undirected graph using simple scheme with array and fibonacci heap and compare the performance/results, preferably in java.

  Develop a reservation system program for specific flights.

develop a reservation system program for specific flights. A customer should be able to select from one of four categories of seats on flights from RDU to any of at least three other destinations. Based on the user input of seat type and destination,..

  Write function in javascript to compute person-s gross pay

Write the function using JavaScript syntax to compute a person's gross pay for a week. The function should receive the number of hours worked and the rate of pay per hour.

  Modify the scholarship application

Modify the Scholarship application so that if a user enters a grade point average under 0 or over 4.0, or a negative value for either of the activities, an error message appears.

  Write a program that converts date formats

Write a program that prompts the user to input an integer between 0 and 35. If the number is less than or equal to 9, the program should output the number; otherwise, it should output A for 10, B for 11, C for 12,..., Z for 35. (Hint: use the case..

  Earn a fixed salary

Write a JavaTM application using NetBeansTM Integrated Development Environment (IDE) that calculates the total annual compensation of a salesperson. Consider the following factors:A salesperson will earn a fixed salary of .

  Program that allows a user to input coordinates

In Java make a program that allows a user to input coordinates as to make a Hexagon via an array, and my professor has set the standards of: Write a class Polygon which draws a hexagon for a set of numbers given by the user.

  Program mimics a rudimentary spreadsheet

Change the averages so that they are rounded to the nearest one hundredth. The example above shows averages in format - Change the program so that before the spreadsheet window is displayed, the user sees the window

  Total annual compensation policy to improve sales

The company has recently changed its total annual compensation policy to improve sales. A salesperson will continue to earn a fixed salary of $30,000. The current sales target for every salesperson is $400,000. Sales incentives are calculated as foll..

  Write and run a java program

Write and run a Java program which allows the user to input two doubles and outputs the greater of the two?

  Create java application to create and maintain contact list

Create a JAVA application to create and maintain a contact list - Create a database to store the contact information.

  Most of the companies use virtualization to make test

write a 200- to 300-word short-answer response to the following many companies use virtualization to create test

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