|
import java.io.*;
import java.lang.*;
import java.util.*;
class primary
{
public static void main(String args[])throws IOException
{
InputStreamReader ob = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(ob);
{
int a,b,c,d; a=0;b=0;c=0;d=0;
System.out.println("***New Hampshire Primary Candidates!***");
for(;;)
{
System.out.println("Candidate A: Bernie Sanders");
System.out.println("Candidate B: Elizabeth Warren");
System.out.println("Candidate C: Joe Biden");
System.out.println("Candidate D: Pete Buttigieg");
System.out.println("Enter your choice (A-D) or X to exit:");
char ch=(char)br.read();
switch(ch)
{
case 'A':
{
System.out.println("You chose candidate Bernie Sanders");
a++;
break;
}
case 'B':
{
System.out.println("You chose candidate Elizabeth Warren");
b++;
break;
}
case 'C':
{
System.out.println("You chose candidate Joe Biden");
c++;
break;
}
case 'D':
{
System.out.println("You chose candidate Pete Buttigieg");
d++;
break;
}
case 'X':
{
System.out.println("***Primary Results!***");
System.out.println("Bernie Sanders:"+a);
System.out.println("Elizabeth Warren:"+b);
System.out.println("Joe Biden:"+c);
System.out.println("Pete Buttigieg:"+d);
System.exit(0);
}
default:
{
System.out.println("Invalid choice. Please enter A, B, C, or
D.");
}
}
}
}
}
}
Assignment 11.2: New Hampshire Primary (10 pts) The New Hampshire Primary is taking place this Tuesday,...
15.1: Tallying Votes Elections are a formal group-decision making process by which a population chooses a person to hold office, such as the mayor of a city. Another use of elections is to accept or reject a political proposition. Most election results are tallied, or counted, using electronic voting. Most electronic voting machines use a computer to take care of the chore of casting and counting votes. This Tuesday, November 6 (the date your assignment is due) is election day....
To combat election fraud, your city is instituting a new voting procedure. The ballot has a letter associated with every selection a voter may make. A sample ballot is shown:- (Voter places a tick next to his or her preferred candidate, proposition and measure to indicate his/her vote) 1. Mayoral Candidates A. Pincher, Penny B. Dover, Skip C. Perman, Sue 2. PROP 17 D. YES E. NO 3. MEASURE 1 F. YES G....
write a code on .C file
Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...
Please answer the following in Python:
The cost of a travel pass includes a $5 administrative charge and the cost of one unit of trips (or 10 trips) at $1.50 per trip. A passenger who has a travel pass can perform these operations make trips as long as there is at least one unconsumed trip, top up in multiples of units of trips without incurring administrative charge get a refund at $1.20 per unconsumed trip C) C) C) When a...
Requires Python to answer
A client wishes to keep track of his investment in shares. Write a program to help him manage his stock portfolio. You are to record both the shares that he is holding as well as shares that he has sold. For shares be is curreatly holding, record the following data: .a 3-character share code, share name, last purchase date, volume currently held and average purchase price (refer to description under part cii) option 2) For shares...
Hello, i need help with this homework:
Code provided:
public class DirectedWeightedExampleSlide18
{
public static void main(String[] args)
{
int currentVertex, userChoice;
Scanner input = new Scanner(System.in);
// create graph using your WeightedGraph based on author's
Graph
WeightedGraph myGraph = new WeightedGraph(4);
// add labels
myGraph.setLabel(0,"Spot zero");
myGraph.setLabel(1,"Spot one");
myGraph.setLabel(2,"Spot two");
myGraph.setLabel(3,"Spot three");
// Add each edge (this directed Graph has 5 edges,
// so we add 5 edges)
myGraph.addEdge(0,2,9);
myGraph.addEdge(1,0,7);
myGraph.addEdge(2,3,12);
myGraph.addEdge(3,0,15);
myGraph.addEdge(3,1,6);
// let's pretend we are on...