Homework help starts he Running simulation #1: Win? false Results: 2019 (48.89361668703168%) - 2110 (51.10638331296832%) 2110 Visualization: ++++ Running simulation #2: Win? false Running simulation Win? false Results: 1709 (32.37949111600082 %) 3569 (67.62050888399918%) Results: 1709 (32. Visualization: ++++ +++++++++ ++++ Visualization: +++++ Running simulation Win? false Running simulation #3: Win? false Running simulation Results: 1980 (48.234527544925358) Win? false Visualization: +++++++++++++++++++ Results: 1980 (48.2 Visualization: +++++ +++++ Results: 1544 (36.5 Visualization: +++++ Running simulation #4: Win? false Results: 1544 (36.5283641634557%) - 2682 (63.4716358365443%) Visualization: +++++++++++++++ Running simulation #5: Win? true - 2125 (51.76547245507465%) Running simulation visualization: ++++ Win? true Results: 3046 (65.34770577752577%) 1615 (34.652294222474225%) 1615 Results: 3046 (65.3 Visualization: +++++The average vote percentage is 46.276741057787866% E TUTORING √x MATH SOLV

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

In image 1, for the visualize the result with + and -

Can you just use another simple way to do it ? Like use for loop and simple calculation to do it? 

because I didnt learn repeat() yet. Thank you

Image two is the expected output.

<
1:54 10 23
U
> m
charge Y 电锯人 第2...
Homework help sta
THEY JOE SOTISHIVUU
1 // Import the java.util.
2- import java.util.*;
3 // Create a public class
public class Main
4
10
11
12
16
17
18
19
tiji
#234478
69
// Create the main() met
public static void mai
{
}
// Create an object
Scanner sc
new Scar
// Create an object
Random r-new Random()
// Create an integer
int districts 10;
// Create an integer
int simulations 5;
// Create a double v
double total_vote_pe
// Declare a boolean
boolean isWin;
// Create a for
for(int i = 0; i
{
// Display the a
System.out.printi
5
6
7
1 // Import the java.util.* Library
2.
import java.util.*;
3
4
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
iPhone 14 Pr...
28
29
30
// Create a public class Main
public class Main
PayPal Chec...
31
32
33
34
35
36
// Create 2
double turno
System.out.p
// Create a
for(int j =
{
37
38
39
40
// Create a
int people
41
// Create a
42
double vote_ 43
// Calculate
44
double votes 45
// Calculate 46
turnout_total 47
// Calculate
votes_total-
48
49
50
// Store the boo
// earned is gre 51
iskin=votes_total 52
// Display the v 53
System.out.print 54
System.out.print 55
System.out.print 56
// Calculate the 57
total_vote_p 58
// Display the n
59
61
62
System.out.print 60
// Display the p
System.out.print
// Display the n
System.out.print 63
// Display the p 64
System.out.print 65
// Visualize the 66
System.out.print( 67
int x-(int)votes 68 }
int y=(int) (turn 69 }
System.out.print
System.out.printl
System.out.print
{
// Create the main() method
public static void main(String[] args)
{
bartleby.com
// Create an object sc of the Scanner class
Scanner sc = new Scanner(System.in);
// Create an object r of the Random class
Random r=new Random();
// Create an integer variable districts and initialize it with 10
int districts
10;
// Declare a boolean variable is Win
boolean iswin;
// Create a for Loop for the number of simulations
for(int i = 0; i < simulations ; i++)
{
italki - What...
// Create an integer variable simulations and initialize it with 5
int simulations
5;
// Create a double variable total_vote_percentage and initilaize it with @
double total vote_percentage=0;
// Create 2 double variables turnout_total and votes_total. Initialize them with @
double turnout_total = 0, votes_total = 0;
System.out.print("\nRunning simulation #" + (i + 1) + ":"+"\n");
// Create a for Loop for the number of districts
for(int j = 0; j < districts ; j++)
{
// Create a random integer from 1 to 1000 and store it in integer variable people
int people = r.nextInt(1000);
// Create a random number from 0 to 1 and store it in double variable vote_percentage
double vote_percentage = Math.random();
Calculate the number of votes
double votes_earned people
and store it in double variable votes_earned
vote_percentage;
// Calculate the total number of voters in all the districts and store it in variable turnout_total
turnout_total turnout_total+ people;
// Calculate the total number of votes our candidate earned in all the districts and store it in variable votes_total
votes_total=votes_total+votes_earned;
int x=(int)votes_total/100;
int y=(int) (turnout_total-votes_total)/100;
System.out.print("("+ (double)(votes_total*100 / turnout_total)+"%)");
// Display the number of votes other candidate received
System.out.printf(" - %.0f",turnout_total-votes_total);
// Display the percentage of votes other candidate received
System.out.println(" ("+(double) (188-votes_total*100 / turnout_total)+"%)");
// Visualize the result with the help of + and - symbols
System.out.print("Visualization: ");
USPS.com®...
}
// Store the boolean value depending on whether the total number of votes our candidate
// earned is greater than the total number of votes other candidate earned and store it in variable is Win
iswin=votes_total>(turnout_total-votes_total);
// Display the value of iswin
System.out.print("Win? ");
System.out.println(iswin);
System.out.print("Results:");
// Calculate the total number of vote percentage for our candidate in all the simulations and store it in variable total_vote_percentage
total_vote_percentage=total_vote_percentage+(votes_total*100 / turnout_total);
// Display the number of votes our candidate received
System.out.printf(" %.0f",votes_total);
// Display the percentage of votes our candidate received
System.out.print("+".repeat (x)+"\n");
System.out.println(" ".repeat(("Visualization: ").length())+"-".repeat(y));
System.out.println();
Flip
}
// Display the average vote percentage
System.out.println("The average vote percentage is "+(total_vote_percentage/simulations)+"%");
JL
17
X
ORING
Answered: U...
+
【转载】《秀...
VX MATH SOLVER
Transcribed Image Text:< 1:54 10 23 U > m charge Y 电锯人 第2... Homework help sta THEY JOE SOTISHIVUU 1 // Import the java.util. 2- import java.util.*; 3 // Create a public class public class Main 4 10 11 12 16 17 18 19 tiji #234478 69 // Create the main() met public static void mai { } // Create an object Scanner sc new Scar // Create an object Random r-new Random() // Create an integer int districts 10; // Create an integer int simulations 5; // Create a double v double total_vote_pe // Declare a boolean boolean isWin; // Create a for for(int i = 0; i { // Display the a System.out.printi 5 6 7 1 // Import the java.util.* Library 2. import java.util.*; 3 4 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 iPhone 14 Pr... 28 29 30 // Create a public class Main public class Main PayPal Chec... 31 32 33 34 35 36 // Create 2 double turno System.out.p // Create a for(int j = { 37 38 39 40 // Create a int people 41 // Create a 42 double vote_ 43 // Calculate 44 double votes 45 // Calculate 46 turnout_total 47 // Calculate votes_total- 48 49 50 // Store the boo // earned is gre 51 iskin=votes_total 52 // Display the v 53 System.out.print 54 System.out.print 55 System.out.print 56 // Calculate the 57 total_vote_p 58 // Display the n 59 61 62 System.out.print 60 // Display the p System.out.print // Display the n System.out.print 63 // Display the p 64 System.out.print 65 // Visualize the 66 System.out.print( 67 int x-(int)votes 68 } int y=(int) (turn 69 } System.out.print System.out.printl System.out.print { // Create the main() method public static void main(String[] args) { bartleby.com // Create an object sc of the Scanner class Scanner sc = new Scanner(System.in); // Create an object r of the Random class Random r=new Random(); // Create an integer variable districts and initialize it with 10 int districts 10; // Declare a boolean variable is Win boolean iswin; // Create a for Loop for the number of simulations for(int i = 0; i < simulations ; i++) { italki - What... // Create an integer variable simulations and initialize it with 5 int simulations 5; // Create a double variable total_vote_percentage and initilaize it with @ double total vote_percentage=0; // Create 2 double variables turnout_total and votes_total. Initialize them with @ double turnout_total = 0, votes_total = 0; System.out.print("\nRunning simulation #" + (i + 1) + ":"+"\n"); // Create a for Loop for the number of districts for(int j = 0; j < districts ; j++) { // Create a random integer from 1 to 1000 and store it in integer variable people int people = r.nextInt(1000); // Create a random number from 0 to 1 and store it in double variable vote_percentage double vote_percentage = Math.random(); Calculate the number of votes double votes_earned people and store it in double variable votes_earned vote_percentage; // Calculate the total number of voters in all the districts and store it in variable turnout_total turnout_total turnout_total+ people; // Calculate the total number of votes our candidate earned in all the districts and store it in variable votes_total votes_total=votes_total+votes_earned; int x=(int)votes_total/100; int y=(int) (turnout_total-votes_total)/100; System.out.print("("+ (double)(votes_total*100 / turnout_total)+"%)"); // Display the number of votes other candidate received System.out.printf(" - %.0f",turnout_total-votes_total); // Display the percentage of votes other candidate received System.out.println(" ("+(double) (188-votes_total*100 / turnout_total)+"%)"); // Visualize the result with the help of + and - symbols System.out.print("Visualization: "); USPS.com®... } // Store the boolean value depending on whether the total number of votes our candidate // earned is greater than the total number of votes other candidate earned and store it in variable is Win iswin=votes_total>(turnout_total-votes_total); // Display the value of iswin System.out.print("Win? "); System.out.println(iswin); System.out.print("Results:"); // Calculate the total number of vote percentage for our candidate in all the simulations and store it in variable total_vote_percentage total_vote_percentage=total_vote_percentage+(votes_total*100 / turnout_total); // Display the number of votes our candidate received System.out.printf(" %.0f",votes_total); // Display the percentage of votes our candidate received System.out.print("+".repeat (x)+"\n"); System.out.println(" ".repeat(("Visualization: ").length())+"-".repeat(y)); System.out.println(); Flip } // Display the average vote percentage System.out.println("The average vote percentage is "+(total_vote_percentage/simulations)+"%"); JL 17 X ORING Answered: U... + 【转载】《秀... VX MATH SOLVER
<
1:54 10 23
U
> m
charge Y 电锯人 第2...
tiji
iPhone 14 Pr...
Homework help starts he
Running simulation
Win? false
Running simulation #1:
Win? false
PayPal Chec...
Running simulation #2:
#Win? false
Results: 2019 (48.89361668703168%) 2110 (51.10638331296832%)
Visualization: ++++++++++++++++++++
Results: 1980 (48.2
Visualization: +++++
Results: 1709 (32.37949111600082%) 3569 (67.62050888399918%)
Results: 1709 (32. Visualization: +++++++++++++++++
Visualization: +++++
Running simulation #4:
Win? false
Running simulation #Results: 1544
Win? false
Running simulation #3:
Win? false
Running simulation #Results: 1980 (48.23452754492535%) 2125 (51.76547245507465%)
Win? false
Visualization: ++++
Results: 1544 (36.5
Visualization: +++++
Visualization: +++++++++++++++
bartleby.com
italki - What...
Running simulation #5:
Win? true
(36.5283641634557%)
Running simulation #visualization: ++++
Win? true
+++++++
+++
. Program finished with exit code U
USPS.com®...
Results: 3046 (65.34770577752577%) 1615 (34.652294222474225%)
The average vote per... Program finished with exit code 0
2682 (63.4716358365443%)
+++++
Results: 3046 (65.3
Visualization: +++++The average vote percentage is 46.276741057787866%
Flip
JL
1
X Answered: U...
E TUTORING
+
【转载】
VX MATH SOLVER
...
Transcribed Image Text:< 1:54 10 23 U > m charge Y 电锯人 第2... tiji iPhone 14 Pr... Homework help starts he Running simulation Win? false Running simulation #1: Win? false PayPal Chec... Running simulation #2: #Win? false Results: 2019 (48.89361668703168%) 2110 (51.10638331296832%) Visualization: ++++++++++++++++++++ Results: 1980 (48.2 Visualization: +++++ Results: 1709 (32.37949111600082%) 3569 (67.62050888399918%) Results: 1709 (32. Visualization: +++++++++++++++++ Visualization: +++++ Running simulation #4: Win? false Running simulation #Results: 1544 Win? false Running simulation #3: Win? false Running simulation #Results: 1980 (48.23452754492535%) 2125 (51.76547245507465%) Win? false Visualization: ++++ Results: 1544 (36.5 Visualization: +++++ Visualization: +++++++++++++++ bartleby.com italki - What... Running simulation #5: Win? true (36.5283641634557%) Running simulation #visualization: ++++ Win? true +++++++ +++ . Program finished with exit code U USPS.com®... Results: 3046 (65.34770577752577%) 1615 (34.652294222474225%) The average vote per... Program finished with exit code 0 2682 (63.4716358365443%) +++++ Results: 3046 (65.3 Visualization: +++++The average vote percentage is 46.276741057787866% Flip JL 1 X Answered: U... E TUTORING + 【转载】 VX MATH SOLVER ...
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 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