Write a program that accepts the names of three political parties and the number of votes each received in the last mayoral election. Display the percentage of the vote each party received. An example of the program is shown below: Enter name for first party >> Pool Party Enter votes received >> 87 Enter name for second party >> House Party Enter votes received >> 54 Enter name for third party >> Surprise Party Enter votes received >> 111 The Pool Party party got 34.523809523809526 percent of the vote The House Party party got 21.428571428571427 percent of the vote The Surprise Party party got 44.047619047619044 percent of the vo

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a program that accepts the names of three political parties and the number of votes each received in the last mayoral election. Display the percentage of the vote each party received.

An example of the program is shown below:

Enter name for first party >> Pool Party Enter votes received >> 87 Enter name for second party >> House Party Enter votes received >> 54 Enter name for third party >> Surprise Party Enter votes received >> 111 The Pool Party party got 34.523809523809526 percent of the vote The House Party party got 21.428571428571427 percent of the vote The Surprise Party party got 44.047619047619044 percent of the vote

* CENGAGE MINDTAP
Q Search this course
Programming Exercise 2-16
Instructions
ElectionStatistics.java +
>- Terminal
1 import java.util.Scanner;
sandbox $ 0
2 class Electionstatistics {
Write a program that accepts the names of three
public static void main(string[] args) {
// write your code here
Lal
political parties and the number of votes each
received in the last mayoral election. Display the
}
</>
percentage of the vote each party received.
6 }
An example of the program is shown below:
Enter name for first party >> Pool Party
Enter votes received >> 87
Enter name for second party >> House Party
Enter votes received >> 54
Enter name for third party > Surprise Party
Enter vot
received >> 111
The Pool Party party got 34.523809523809526 perce
The House Party party got 21.428571428571427 perc
The Surprise Party party got 44.047619047619044 F
Grading
Write your Java code in the area on the right. Use
the Run button to compile and run the code.
Clicking the Run Checks button will run pre-
configured tests against your code to calculate a
grade.
Transcribed Image Text:* CENGAGE MINDTAP Q Search this course Programming Exercise 2-16 Instructions ElectionStatistics.java + >- Terminal 1 import java.util.Scanner; sandbox $ 0 2 class Electionstatistics { Write a program that accepts the names of three public static void main(string[] args) { // write your code here Lal political parties and the number of votes each received in the last mayoral election. Display the } </> percentage of the vote each party received. 6 } An example of the program is shown below: Enter name for first party >> Pool Party Enter votes received >> 87 Enter name for second party >> House Party Enter votes received >> 54 Enter name for third party > Surprise Party Enter vot received >> 111 The Pool Party party got 34.523809523809526 perce The House Party party got 21.428571428571427 perc The Surprise Party party got 44.047619047619044 F Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre- configured tests against your code to calculate a grade.
Instructions
Cectionicatieja
mincl ciastr
incl catrin
Wriea program sha acceps the ames of three peltical paa and thenumber ofvate ach
ecaived in she lat mayoral election. Dipiay the percenage of the vane ach parny neceived
ehem B
t inader (t vate.
a prietitustring caates, i t),
dosble alolatrw wll, wte
Anample of he program it thown beiow
ter e ar t perly Pe Party
ter ts te
Betar ne r sn arty Party
Betar in rein
conr it Aan - .
ter e pety eprie Perly
ter tn rnt
Pe Perr pey pet pernt e vete
Party arty 11.car ar pe e
turra Party arty .eraeras p e
string candiatas oC sl.
cut e vlaae input the candicutes follod y the wote ay recied i ith s:
for (int -, ans, )
cin caraian[4] vetei,
Grading
rinaitufcantiates, wat
* cancianeindiart] ni
cout e te ie:
Wrie your java cade in she ana on she right. Le the Run burron sa compile and nun the cade.
Cicking she Run Checka buman will nun pre-canfigured t again your code to calcuacaa
ada
dobe aloulatr vtl. n wte
t tte
Once you are happy wth your neus, click the Submit buron a record your score.
1 eerwse n an)
vte.
ctetes
dale percetage - static catalen(vate) / ualvones,
retu percatage,
vea prietinustring cantes), t tIH
uta) ts e u e Perctage: ndi;
for (int -, as, i{
ct e candiutesa sat ut
at perctage- calculatererceitagetwat, ti.
cat e iage di;
ee firader (n vutei
int wirer-,
for (iee -, n, i
if (vutesalsiw)
retu ier
Transcribed Image Text:Instructions Cectionicatieja mincl ciastr incl catrin Wriea program sha acceps the ames of three peltical paa and thenumber ofvate ach ecaived in she lat mayoral election. Dipiay the percenage of the vane ach parny neceived ehem B t inader (t vate. a prietitustring caates, i t), dosble alolatrw wll, wte Anample of he program it thown beiow ter e ar t perly Pe Party ter ts te Betar ne r sn arty Party Betar in rein conr it Aan - . ter e pety eprie Perly ter tn rnt Pe Perr pey pet pernt e vete Party arty 11.car ar pe e turra Party arty .eraeras p e string candiatas oC sl. cut e vlaae input the candicutes follod y the wote ay recied i ith s: for (int -, ans, ) cin caraian[4] vetei, Grading rinaitufcantiates, wat * cancianeindiart] ni cout e te ie: Wrie your java cade in she ana on she right. Le the Run burron sa compile and nun the cade. Cicking she Run Checka buman will nun pre-canfigured t again your code to calcuacaa ada dobe aloulatr vtl. n wte t tte Once you are happy wth your neus, click the Submit buron a record your score. 1 eerwse n an) vte. ctetes dale percetage - static catalen(vate) / ualvones, retu percatage, vea prietinustring cantes), t tIH uta) ts e u e Perctage: ndi; for (int -, as, i{ ct e candiutesa sat ut at perctage- calculatererceitagetwat, ti. cat e iage di; ee firader (n vutei int wirer-, for (iee -, n, i if (vutesalsiw) retu ier
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY