Two team captains are present at the toss of a match, you need to write a program that will ask the host team captain to enter choice among 0 or 1, then the program randomly generates a number 0 or 1 and print whether the host team wins or guest team wins the toss. Note: Host team will win If the number generated matches with the choice of the host.
Q: setprecision (n) : when used in conjunction with fixed, set the number of digits after the decimal…
A: Below is the code and sample output:
Q: in this code, the integer on each line shows the line number that is not part of code: write line…
A: public static int sum(int x, int y){ int z = x +y;//adds both input parameters and stores result in…
Q: Exercise 2 Write a program that asks the user to enter their student ID and course code (like…
A: Python code for given question is given below.
Q: F &B Fast-Food Restaurant offers three types of menu. Each customer can make an order based on the…
A: Use an infinite loop and prompt for user choice and if input is X, we will exit for day and print…
Q: A weather station provides a couple of daily temperatures (maximum, minimum) (it is not possible for…
A: STEP1: START STEP2: define variables minTemp = 0, maxTemp = 0, days = 0, minSum = 0, maxSum = 0,…
Q: Write an expression that obtains a random integer between 34 and 55. Write an expression that…
A: To get a random number we will use rand() in c++, also we are going seed time as a parameter to…
Q: Question 1 Write a program that finds the new salary of an employee after several years of work…
A: Note: Programming language not mentioned in the question. C++ is chosen for implementation.…
Q: In a program, write the program's algorithm that calculates the sum of odd integers (T1) from 1 to…
A: n=int(input()) t1=0 t2=0 t3=0 for i in range(1,n+1,2): t1+=i for i in range(2,n+1,2): t2+=i…
Q: This function will calculate the n term in the Fibonacci Numbers and return in fib_no. By…
A: ALGORITHM:- 1. Take input for the fibonacci number until a positive number is not entered. 2. Pass…
Q: Write a program to calculate the GPA in First semester. 1- The program asks the marks out of 100 in…
A: Explanation: Arrays of marks, weight and GPA are created. Input is taken in the marks array, and…
Q: Exercise 5: ■ Write a program that finds the summation for the odd and even numbers [for the numbers…
A: 1.Write a program that finds the summation for the odd and even numbers [for the numbers from 0 to…
Q: nput a value for the variable y so that the variable x becomes 4 after the code executes.…
A: According to the Question below the Solution:
Q: USING PYTHON, Write a program that calculates the amount of money a person would earn over a period…
A: The given problem is to be solved using Python programming which will calculate the salary of a…
Q: Given the sample code above in generating a random number. Create a program that lets the user play…
A: Code: #include <iostream> using namespace std; int main(){ //declare variableint userChoice,…
Q: At a certain university, students have to submit their exams online. The administration decides that…
A: Code import java.util.*;public class Main{ public static void main(String[] args) { int…
Q: Print "user_num1 is negative." if user_num1 is less than 0. End with newline. Assign user_num2 with…
A: logic:- read first number if number1<0 display number1 is less than 0 read second number if…
Q: 4.5 If / else and switch selections Table 4.5: University of Pagoh (UF) student score vs grade grade…
A: Given that, University of Pagoh (UF) student score vs grade, Score Grade Display 80-100 A…
Q: Voltage readings are obtained from an electrical substation once every hour for six hours Write a…
A: The Program language is not mentioned here. So, I am using C language to answer your question. The C…
Q: Q1 // Follow the following program, explaining the results: (If you know that L is your grade in the…
A: - We have to track the values of L and K from the program given.
Q: In many sports events, contestants are rated by judges with an average score being determined by…
A: PROGRAM INTRODUCTION: Declare and initialize a variable to store the sum of the scores. Start the…
Q: Create two integer variables: x and y. Print if those variables are in following conditions: • x €…
A: Part-1 : create two integer variables : x and y . print if those variables are in following…
Q: Write a program that determines the real roots of a quadratic equation. To calculate the roots of…
A: Given: given by: D = b ^ 2 - 4ac . If D > 0 the program displays message "The equation has two…
Q: ete the function that calculates the sum of the first n+1 terms of the geometric series a, ar,…
A: Please find the answer below :
Q: Given the following mystery function, what is the output if the number passed to the function is 7:…
A: We are given a recursive function code in c++ which is called with value 7. I have answered the…
Q: if user_tickets< 5: num_tickets=1 else: num_tickets= user_tickets
A: Purpose: Check whether a number "user_tickets" entered by user is less than 5 or not. If yes then…
Q: The Meteorological service requires a program to allow the operator to enter the rainfall level. The…
A: use while loop to take values until zero is pressed. store the values into array and then find min…
Q: The average cost of a college textbook is $125. There is a premium of 20% on hardcover text and a…
A: conditions :- In case of hardcover text if n>4 total=n*avg_cost+ (premium*(n*avg_cost)/100)…
Q: Assume that you have price distributions as follows: (000 - 299 $), (300 - 599 $), (600 - 899 $),…
A: Programs: Programs are used to provide instructions to the computer system in order to perform…
Q: Re-write code Comment also in code Provide right code Gurantee downvote for in correct…
A: I have re-write the code below witch attached a screenshot of the code with output:
Q: Write an application that displays the multiplication table for numbers from 1 to 9. The table…
A: Java code: public class Main { //class public static void main(String[] args) { //main…
Q: A long-distance carrier charges the following rates for telephone calls: Starting Time of Call…
A: I have given python code below.
Q: int x = 5, y = 2, z = 3; if ( x z) cout 2 ) { cout << z <<" "<< y-x << endl; cout << z * (x + y)<<…
A: The program is written in C++ Language. Please find the source code and output in the below steps
Q: Q8. The factorial of a positive integern is defined as n! = n*(n-1)*(n-2)*...*2*1. So the factorial…
A: Note: As you have not mentioned any programming language, I am writing the program in C++. 1.…
Q: Canada has three national holidays which fall on the same dates eac Holiday New year's day Canada…
A: Python used to answer this question
Q: A long-distance carrier charges the following rates for telephone calls between the United States…
A: Given: To write a program that asks for the starting time and the number of minutes of the call,…
Q: // format and display output Number Format number = Number Format.getNumber Inst…
A: The completed code is below:
Q: Assume that you have price distributions as follows: (000 - 299 $), (300 – 599 $), (600 – 899 $),…
A: ALGORITHM:- 1. Take input for each occurences. 2. Check if the input is greater than 50. 3. Print…
Q: A Fibonacci Number sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... The next…
A: #include <iostream>using namespace std; void FibonacciNumber(int n, int &fib_no){ int a…
Q: Given the sample code above in generating a random number. Create a program that lets the user play…
A: According to the information given:- We have to create rock paper and scissor game on the basic of…
Q: ShowCurrentTime.py, gives a program that displays the current time in GMT. Revise the program so…
A: Code to copy:- import time print("This Program Displays The Time In The Specified Time…
Q: How many total stars will be displayed by each of the following program segments? A) for (row = 0;…
A: Part A will print 600 stars.
Q: The user must be able to enter the information for a number of bookings from the keyboard. Ask…
A: In the solution of given problem, we need to declare a structure with members: flight number, type…
Q: rite a program that reads the subtotal and the gratuity rate, then computes the gratuity and total.…
A: Approach:- first read subtotal and GratuityRate Calculating Gratuity :- Gratuity = (subtotal *…
Q: The user must be able to enter the information for a number of bookings from the keyboard. Ask…
A: Step 1:- Given:- The user must be able to enter the information for a number of bookings from the…
Q: Given the sample code below in generating a random number. Create a program that lets the user play…
A: #include <iostream> #include <string> //to work with strings #include <cstdlib>…
Q: a). Write a NumPy program to generate 50 random number between 0 and 150. If your number bigger than…
A: Please give positive ratings for my efforts. Thanks. SUMMARY As per guidelines we are allowed to…
Q: The program segment has errors. Find as many as you can. // This code should display the sum of two…
A: There are two mistake in the code semi-Colum is missed after the while condition then condition in…
Two team captains are present at the toss of a match, you need to write a
Step by step
Solved in 3 steps with 1 images
- Your program will prompt the user for the following information: current population number of yearly births from the previous year number of yearly deaths from the previous year number of years into the future for your predictive value of the future population. You will then compute the following: birth rate death rate growth rate the predicted future population Assignment Notes: To allow the user to input the numeric data (such as current population) it is necessary to use the input function. The input function takes a string in parenthesis that prompts the user what to enter. The computer then waits until the user types a response, terminated by the user typing the Enter key. A string, as a sequence of characters, is returned to the variable on the lefthand side of the assignment statement. For example: currPopulation = input(“Enter the current US population”) The data in currPopulation is a string (because that is what the input statement does) but we need it to be a number…Birthday party At Lili's birthday party, there was a game arranged by Jojo as the host. That game is to distribute Y number of candy to X number of people where all the candy tastes sweet except for one last candy which tasted like rotten nuts. Candy distribution will be sequentially starting from position Z and if past the last position then the distribution of candy continues to the first position. Write down the person in which position will get the last candy. Input FormatThe first line of input is T, which is the number of test cases.The second row and the next number of T rows are X, Y, Z.X is the number of people to whom the candy will be distributed.Y is the number of candy available.Z is the starting position of the person to whom the candy will be distributed. Output FormatA string “Case #N: “ and a number representing the position of the person who got the last candy. Constraints1 ≤ T ≤ 1001 ≤ X, Y ≤ 1031 ≤ Z ≤ X Sample Input 43 4 13 5 24 2 24 5 2 Sample OutputCase #1: 1Case…Birthday party At Lili's birthday party, there was a game arranged by Jojo as the host. That game is to distribute Y number of candy to X number of people where all the candy tastes sweet except for one last candy which tasted like rotten nuts. Candy distribution will be sequentially starting from position Z and if past the last position then the distribution of candy continues to the first position. Write down the person in which position will get the last candy. Input FormatThe first line of input is T, which is the number of test cases.The second row and the next number of T rows are X, Y, Z.X is the number of people to whom the candy will be distributed.Y is the number of candy available.Z is the starting position of the person to whom the candy will be distributed. Output FormatA string “Case #N: “ and a number representing the position of the person who got the last candy. Constraints? ≤ ? ≤ ???? ≤ ?, ? ≤ ???? ≤ ? ≤ X Sample Input 43 4 13 5 24 2 24 5 2 Sample OutputCase #1: 1Case…
- A weather station provides a couple of daily temperatures (maximum, minimum) (it is not possible for either or both temperatures to be 9 degrees). The end temperature pair is 0, 0. Create a program that determines the number of days, whose temperatures have been provided, the maximum and minimum averages, the number of errors - temperatures of 9 ° - and the percentage they represented. perfer pythonYou must have 2 functions: one computes the average and the other finds the letter grade. The average function should return back a Real value and the letter grade function should return back a string. All input and output must occur in main(). Only find and display the letter grade for the average, not each test score. Should be an algorithm done in pseudocode.Many documents use a specific format for a person's name. Write a program that reads a person's name in the following format: firstName middleName lastName (in one line) and outputs the person's name in the following format: lastName, firstInitial.middleInitial. Ex: If the input is: Pat Silly Doe the output is: Doe, P.S. If the input has the following format: firstName lastName (in one line) the output is: lastName, firstInitial. Ex: If the input is: Julia Clark the output is: Clark, J.
- A mobile phone service has three different data plans for its customers: PLAN A: For $19.99 per month, 2 gigabytes are provided. Additional usage costs $8.00 per gigabyte. PLAN B: For $59.99 per month, 8 gigabytes are provided. Additional usage costs $8.00 per gigabyte. PLAN C: For $79.99 per month, Unlimited data is provided. Write a program that calculates a customer’s monthly bill. It should input the customer name, which plan was purchased, and how many gigabytes were used. It should then create a bill that includes the input information and the total amount due. It should also display how much money plan A customers would save if they purchased plan B or C, and how much money plan B customers would save if they purchased plan C. If there would be no savings, no message should be printed. Wherever possible, use named constants instead of numbers.(Statistics) This is the formula for the standard normal deviate, z, used in statistical applications: z=(X)/ X is a single value. refers to an average value. refers to a standard deviation. Using this formula, you need to write a program that calculates and displays the value of the standard normal deviate when X=85.3,=80,and=4. a. For this programming problem, how many outputs are required? b. How many inputs does this problem have? c. Determine a formula for converting input items into output items. d. Test the formula written for Exercise 7c, using the data given in the problem.Malcolm Movers charges a base rate of $200 per move plus $150 per hour and $2 per mile. Write a program named MoveEstimator that prompts a user for and accepts estimates for the number of hours for a job and the number of miles involved in the move and displays the total moving fee.
- The two roots of a quadratic equationax2 + bx + c = 0 can be obtained using the following formula:b2 - 4ac is called the discriminant of the quadratic equation. If it is positive, theequation has two real roots. If it is zero, the equation has one root. If it is negative,the equation has no real roots.Write a program that prompts the user to enter values for a, b, and c and displaysthe result based on the discriminant. If the discriminant is positive, display tworoots. If the discriminant is 0, display one root. Otherwise, display “The equationhas no real roots.”Note you can use Math.pow(x, 0.5) to compute √x. Here are some sampleruns: Enter a, b, c: 1.0 3 1 ↵EnterThe equation has two roots -0.381966 and -2.61803Programming Language: Java Direction: Write a program to determine the number of PASSED and FAILED out of 15 inputted names with the corresponding grade. Restrict the inputted grade for each name in the range of 50 to 100, in which 75 is the passing grade. If the inputted grade is not on the range, the program will remind the user of a message for the accepted range for the grade and allows the user to re-enter a grade. NOTE: MUST ADD COMMENTSThe use of computers in education is referred to as computer-assisted instruction (CAI). Write a program that will help an elementary-school student learn multiplication. Use the rand function to produce two positive one-digit integers. The program should then prompt the user with a question, such as How much is 6 times 7?The student then inputs the answer. Next, the program checks the student’s answer. If it’s correct, display the message "Very good!" and ask another multiplication question. If the answer is wrong, display the message "No. Please try again." and let the student try the same question repeatedly until the student finally gets it right. A separate function should be used to generate each new question. This function should be called once when the application begins execution and each time the user answers the question correctly. i made this code so far : //Name: IhabAtouf//Date:02/23/2023// exercise 6.57 on page 281//program description: create computer-assisted…