Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that will implement a computerized voting system that functions like the output sample. In a loop, which will go on forever

Write a Java program that will implement a computerized voting system that functions like the output sample. In a loop, which will go on forever unless the secret administrative code of 5 is entered, you must: Print the candidate menu. Wait for input. If the input is a valid choice bump up the tally of the selected candidate, bump up the tally of total votes cast, print VOTED, and return to the menu. If someone types anything other than 1-5 print out: ***ERROR***invalid entry, bump up no tally, and go back to the menu. When the administrative code 5 is entered and you have exited the loop, print out the total number of votes cast and then show the number of votes for each candidate. For extra credit, after the FINAL TALLY is printed, print out who the winner is. For extra extra credit take into account ties. These input values are samples only. Obviously. When the (secret) code of 5 is entered the election is over must use for or while loop. name it evote. sample:2020 EVOTE STSTEM ================ Electronic Voting System ------------------------ 1)Hillary Clinton 2)Donald Trump 3)Barack Obama 4)Ivanka Trump Cast your ballot for? (1, 2, 3, or 4)4 VOTED Electronic Voting System ------------------------ 1)Hillary Clinton 2)Donald Trump 3)Barack Obama 4)Ivanka Trump Cast your ballot for? (1, 2, 3, or 4)3 VOTED Electronic Voting System ------------------------ 1)Hillary Clinton 2)Donald Trump 3)Barack Obama 4)Ivanka Trump Cast your ballot for? (1, 2, 3, or 4)1 VOTED Electronic Voting System ------------------------ 1)Hillary Clinton 2)Donald Trump 3)Barack Obama 4)Ivanka Trump Cast your ballot for? (1, 2, 3, or 4)2 VOTED Electronic Voting System ------------------------ 1)Hillary Clinton 2)Donald Trump 3)Barack Obama 4)Ivanka Trump Cast your ballot for? (1, 2, 3, or 4)4 VOTED Electronic Voting System ------------------------ 1)Hillary Clinton 2)Donald Trump 3)Barack Obama 4)Ivanka Trump Cast your ballot for? (1, 2, 3, or 4)5 ================================== FINAL TALLY: [5 total votes cast] Hillary Clinton- 1 Donald Trump- 1 Barack Obama- 1 Ivanka Trump- 2

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

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions