Instructions Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate’s name (Candidate), the number of votes received (Votes Received), and the percentage of the total votes received by the candidate (% of Total Votes). Your program should also output the winner of the election. Your program must contain at least the following functions: a function to determine the sum of votes. a function to output the winner of the election. This needs to be done in C++
Q: Write a program that determines which of a company’s four divisions (Northeast, Southeast,…
A: #include <iostream>#include <string>#include <limits> using namespace std; const…
Q: A bullet train slows from a speed of 200 mi/hr to 150 mi/hr in one minute. Write a computer program…
A: The answer is
Q: (a) Write a function get_month() that asks the user for a month, using the prompt string "Please…
A: The function is the block of the organized code which is used to perform the specified task.
Q: Create a function that takes a number as an argument and returns "Fizz", "Buzz" or "FizzBuzz" If the…
A: As the programming language is not mentioned here, we are using JAVA The JAVA code is given below…
Q: The function below takes two arguments: a string (name) and an integer (position). Complete the…
A: To solve this problem, we need to define a function print_welcome( ) using def keywords, It takes…
Q: Complete the following program. An object floats in any fluid, if the density of the object is lower…
A: Sample Response: //C++ programming language, tested on CodeBlock IDE#include<iostream>using…
Q: The following statement calls a function named half, which returns a value that is half that of the…
A: double half(double num) { return num/2; } In the above function, it will accept num as a…
Q: LeakageDeduction.py Write a python program that calculates the salary deduction of an employee who…
A: SOURCE CODE: n=int(input("Enter number of employees:")) #read number of employees l=[] price=0.180…
Q: The distance between two points pA (XA,YA) and pB (XB,YB) is calculated as follows V(XA-XB)+(YA–YB)…
A: Find the required code in C++ given as below and sample output :
Q: Write a program that allows the user to enter the last names of five candidates in a local election…
A: Programs: Programs contain a set of instructions, to perform certain tasks. The instructions are…
Q: Assign number to functions (+,-,*,/,-RND= Random number,AC=All clear,to end the program) The…
A:
Q: When each argument in a function consists of a variable name and a value, we use arguments.
A: Option (a) Default value argument
Q: Instructions Write a program that allows the user to enter the last names of five candidates in a…
A: In the given information is: Your program must contain at least the following functions: a function…
Q: • High and Low Write a program that determine which number is higher between two integers. Get the…
A: The Answer is
Q: The prompt asks me to design a program that asks the user to enter a month (in numeric form), a day,…
A: Following is the c++ program which takes input from user the day, month and year of date. If else…
Q: Write a function that would calculate an item's sale price based on the item's purchase price plus…
A: Note: since programming language is not mention we are providing solution in c++. please repost the…
Q: Write a split_check function that returns the amount that each diner must pay to cover the cost of…
A: We need to provide definition of function split_check function that returns the amount that each…
Q: Write a program that accepts as input a number indicating the number of laps a runner walked around…
A: Step 1 : Start Step 2 : Define the function laps2miles() which accepts the number of Laps as…
Q: A bank charges $10 per month, plus the following check fees for a commercial checking account:…
A: I'm using Visual Basic programming to create the code & display the result. I hope this will be…
Q: Write a program that allows the user to enter the last names of five candidates in a local election…
A: Algorithm: Start Read last name of votes of five candidates Find sum of all votes Find percentage…
Q: Complete the following program. An object floats in any fluid, if the density of the object is lower…
A: The program illustrates calculating density and printing the message based on the given constraint.…
Q: Write a pay-raise program that requests a person's first name, last name, and current annual salary…
A: You didn't define language for problem, So i am doing it in C++ programming language #include…
Q: LeakageDeduction.py Write a python program that calculates the salary deduction of an employee who…
A: First we will calculate the leakage using the formula: Leakage = Quantity - (CR - PR) Then, we will…
Q: Python Programming question
A: PROGRAM: #Defining the function calc_function def calc_average(sc1,sc2,sc3,sc4,sc5): #Calculating…
Q: For every plant, there is a growth cycle. The number of days that it takes starting from being a…
A: The solution for the above given question is given below:
Q: The program has 2 inputs: miles_per_gallon and dollars_per_gallon. The function has 3 parameters:…
A: Cost for driven_miles = (driven_miles/miles_per_gallon) * dollars_per_gallon
Q: Write a split_check function that returns the amount that each diner must pay to cover the cost of…
A: According to the information given:- we have to create a split_check function to divide the dinner…
Q: Create a function that takes a number as an argument and returns "Fizz", "Buzz" or "FizzBuzz" ● If…
A: def fizz_buzz(num): if num%3==0 and num%5==0: return"FizzBuzz"…
Q: Write a program that allows the user to enter the last names of five candidates in a local election…
A: PROGRAM: //Header files #include <iostream> #include <string> #include <iomanip>…
Q: Task 3 Write a function called foo_moo that takes a number as an argument and returns the following…
A: def foo_moo(n): # check if number is divisible by 2 and 3 return FooMoo if(n%2==0 and…
Q: Programming Exercise C++ Instructions : Write a program that outputs inflation rates for two…
A: Algorithm: Start Read current price of the item currentPrice Rear price of the item one year ago…
Q: Write a program that takes input two numbers for and store it in two variables named gross_salary…
A: C program with function calculate_tax is present to calculate the amount of tax.
Q: Hi please Solve in c language. (Wattan Corporation) is an Internet service provider that charges…
A: Begin by creating the file usage.txt and save the data in it. Define header file <stdio.h>…
Q: Write a program that takes input two numbers for and store it in two variables named gross_salary…
A: if (saving < 100000) { taxable_income = sal+saving; } else { taxable_income =…
Q: Write a python program that accepts name of an employee and employee's yearly sales of last five…
A: Required:
Q: One lap around a standard high-school running track is exactly 0.25 miles. Write a program that…
A: Declare the function MilesToLaps Inside the function use formula double laps = userMiles * 4 as 1…
Q: The distance between two points pA (XA,YA) and pB (XB,YB) is calculated as follows Distance =…
A: The program is written in C. Please find the solution and output in the following steps.
Q: The factorial n! of a positive number (integer) is defined by n! = n · (n – 1) · (n – 2 ) ...- 3·…
A: Firstly, create a file with name - B000000_P6_fact.m and, paste the below given Program code: %…
Q: The prompt asks: Write a function that calculates the amount of money a person would earn over a…
A: Program Approach-1)Define function named totalEarned () with years as a parameter.2)Declare and…
Q: A computer program receives 5 (FIVE) input scores. Next, it calculates total and average scores in a…
A: We are going to create C++ code which will first ask user to input 5 subject's scores and then will…
Q: One foot equals 12 inches. Write a function, using python, named feet_to_inches that accepts a…
A: function feet_to_inches(feet): Start Declare and initialize inches = 12 return feet * inches Stop
Q: Write a function that calculates the amount of money a person would earn over // a period of years…
A: Program approach: Define function named totalEarned () with num_years as a parameter. Prompt the…
Q: Write a program that asks the user to enter an item’s wholesale cost and its markup percentage. It…
A: PROGRAM CODE: #include <iostream>#include <iomanip>using namespace std; // function…
Q: // // Write a function that calculates the amount of money a person would earn over // a period of…
A: Program: <html> <body> <script> //to calculate total number of pennies function…
Q: The Card Box Problem C++ you should write documentation for your program. Using functions, write…
A: Given a flat cardboard of a certain area, generate a box by cutting of squares from the corners of…
Q: You have probably given programming assignments with a complete list of requirements as well as a…
A: Given The above instructions of java function program below
Q: include coding matlab , Give the user the option to stimulate the projectile motion on four…
A: According to the information given:- We have to stimulate the projectile motion. in matlab on the…
Q: *Write a program to calculate your costs for attending college UnitCost= $31 per unit 1) Input -…
A: The, code has given below;
Q: The following program will prompt the user for a starting number and an // ending number. Assume…
A: Programming instructions: Prompt the user to take inputs and store them in the variables. Calculate…
Q: // // Write a function that calculates the amount of money a person would earn over // a period of…
A: Program plan: Define a function named totalEarned() with years as a parameter. Declare and…
Instructions
Write a
Your program must contain at least the following functions:
- a function to determine the sum of votes.
- a function to output the winner of the election.
This needs to be done in C++
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Instructions Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate’s name (Candidate), the number of votes received (Votes Received), and the percentage of the total votes received by the candidate (% of Total Votes). Your program should also output the winner of the election. Your program must contain at least the following functions: a function to determine the sum of votes. a function to output the winner of the election.Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate’s name (Candidate), the number of votes received (Votes Received), and the percentage of the total votes received by the candidate (% of Total Votes). Your program should also output the winner of the election. Your program must contain at least the following functions: a function to determine the sum of votes. a function to output the winner of the election. A sample output is: Candidate Votes Received % of Total Votes Johnson 5000 25.91 Miller 4000 20.73 Duffy 6000 31.09 ... ... ... Total Votes: 19300Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate’s name (Candidate), the number of votes received (Votes Received), and the percentage of the total votes received by the candidate (% of Total Votes). Your program should also output the winner of the election. Your program must contain at least the following functions: a function to determine the sum of votes. a function to output the winner of the election. A sample output is: Candidate Votes Received % of Total Votes Johnson 5000 25.91 Miller 4000 20.73 Duffy 6000 31.09 ... ... ... Total Votes: 19300 The Winner of the Election is Duffy The program must contain Code Pattern: cout << "Candidate\s+Votes Received\s+% of Total Votes"
- A bullet train slows from a speed of 200 mi/hr to 150 mi/hr in one minute. Write a computer program that calculates the bullet train’s constant rate of acceleration and determines how long the bullet train will take to come to rest, given an initial speed of 200 mi/hr. (Hint: Use the equation a = vf - vi t where a is acceleration, t is time interval, vi is initial velocity, and vf is final velocity.) Write and call a function that displays instructions to the program user and a function that computes a, given t, vf, and vi. using c programming language(a) Write a function get_month() that asks the user for a month, using the prompt string "Please enter a month (1 - 12): " The function returns the integer month the user entered. However, the function must also check that the user entered a number in the range 1 - 12 inclusive; if not, the function should print "Your answer must be in the range 1 - 12" and it should then re-prompt for the month. This process must repeat until a valid month is entered. See the examples in photo 1. (b) Write a function make_ends(nums) that takes a list of ints nums and returns a new list of length 2 containing the first and last elements from the original list. See the examples in photo 2.Write a program that takes input two numbers for and store it in two variables named gross_salary and savings. The program then passes these two values to a function named calculate_tax(). The calculate_tax() function determines the tax amount as per the following criteria: i. If savings are less than 100,000, the whole amount will not be included in taxable income. However, if the amount is more than 100,000 (suppose 110,000), the amount that will be included in the taxable income will be calculated as follows: Savings - 100,000 as we supposed our savings are 110,000, the above formula will give value as under: 110,000 - 100,000 = 10,000 This means, if we have savings of 110,000, only 10,000 will be included in taxable income. So, the total taxable income will be calculated as under if (savings >100.000) taxable income = gross_salary + (savings - 100,000) else taxable_income = gross_salary + savings Note : this c++ program please try to solve within 30 minutes
- The prompt asks me to design a program that asks the user to enter a month (in numeric form), a day, and a two-digit year. The program should then call a function to determine whether the month times the day equals the year. If so, it should display a message saying the date is magic. Otherwise, it should display a message saying the date is not magic.Write a program that accepts as input a number indicating the number of laps a runner walked around a track. Then it invokes (calls) the function named laps2miles() which calculates the number of miles walked, then the main program outputs/displays the number of miles walked. Notes: One lap around a standard high-school running track is exactly 0.25 miles. You develop the function laps2miles() and decide if parameters are necessary. The function's task is to compute the miles provided the number of laps Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print(f'{your_value:.2f}')/*Write a program to calculate your costs for attending college UnitCost= $31 per unit 1) Input - to be done in main() Prompt the user for and input the number of units. Prompt the user for and input the amount for student fees. 2) Calculate the total (do not consider parking) Unit cost should be given as a # define. Must use a function to calculate the total. The function must have the following prototype (declaration).double calcTuition(double units, double studentFees); 3) Output the total amount. You must use a function to output the total. The function must have the following prototype (declaration). void output(double total); You must have your name both as a comment in the code and print it along with your student CWID # to the output. 4) Copy your output as a comment to the bottom of the source code. PreviousNext
- Given the following code and program output:int main() { double account = 53000; cout << account << "\n"; debit(account, 2300); cout << account << "\n"; return 0;}Example Output5300050700 Code a function definition for a function named debit that does the following:1) Accepts an account balance and amount to withdraw.2) Decrements the account balance by the amount.Write a split_check function that returns the amount that each diner must pay to cover the cost of the meal. The function has 4 parameters: bill: The amount of the bill. people: The number of diners to split the bill between. tax_percentage: The extra tax percentage to add to the bill. tip_percentage: The extra tip percentage to add to the bill. The tax or tip percentages are optional and may not be given when calling split_check. Use default parameter values of 0.15 (15%) for tip_percentage, and 0.09 (9%) for tax_percentage. Sample output with inputs: 25 2 Cost per diner: 15.5 Sample output with inputs: 100 2 0.075 0.21 Cost per diner: 64.25 python # FIXME: Write the split_check function. HINT: Calculate the amount of tip and tax,# add to the bill total, then divide by the number of diners. ''' Your solution goes here ''' bill = float(input())people = int(input()) # Cost per diner at the default tax and tip percentagesprint('Cost per diner:', split_check(bill, people)) bill =…only pythonYour program should ask the user to input a number of family members. The program should then repeatedly ask the user to input the age of a family member until the specified number of family members is reached. Finally, the program should output the average age of the family members based on the input values. If the user inputs zero for the number of family members, the program should output a friendly message informing the user that at least 1 family member is required. A function has already been defined for you which asks the user for the age of a family member. You must use this function as part of your solution. Your solution must be implemented using a for loop on a range.add on to this: def ask_for_age(): age = int(input('Enter the age of a family member: ')) return age