The goals scored in a soccer match may be inputted as a sequence of Is and 2s terminated by 0. The number 1 would mean that team 1 made a goal and 2 would mean that team 2 made a goal. Thus the sequence 12121120 means that Team I made 4 goals and team 2 made 3 goals in all. Write a program that would input such sequence and output how many goals each team made and the result of the match ("Team 1 won", Team 2 won!", "Both tied!"). Ensure that inputs are 0,1 and 2 only. For example: Input Result
Q: Write a program whose input is a character and a string, and whose output indicates the number of…
A: Here I have asked the user for character and the string and stored them into separate variables.…
Q: Write a program that determines a student grade's given his/her final score. Use the following table…
A: According to the Question below the Solution: Output:
Q: Write a program that displays all the leap years, ten per line,from 2014 to 2114, separated by…
A: Since the Programming language is not mentioned in the question, we will answer this question in…
Q: Write a program that reads a person's first and last names separated by a space, assuming the first…
A: First, we will input first and last name. Then we will replace space with ", ". And finally, print…
Q: Given an a dollar amount Write a program to convert it into Maximum number of bills to give * 100s,…
A: Source Code dollar.cpp #include<bits/stdc++.h> using namespace std; int main(){ int…
Q: Write an LMC program that generates the Fibonacci series. Write a Little Man program that prints…
A: LMC Program that generates the Fibonacci series Answer : Code: INP STA N LOOP LDA…
Q: 9. Write a program to print out all Armstrong numbers between 1 and 500. If sum of cubes of each…
A: Here let's define a function sumCube() to find sum of cube of digits.
Q: A group of monkeys have N bananas in day 1. In the next each day, these monkeys eat half the number…
A: For this, first lets take an examplewith d= day which is givenn = no of banana left on day d Let d =…
Q: Write a program that prompts the user to enter two integer values and prints all numbers between the…
A: The Java code along with the snapshot of code and output is given below:
Q: Suppose that the first number of a sequence is x, where x is an integer. Define a0= x; an+1=an/2 if…
A: Following is the C++ program that takes as input from user the value of x. Then using the while loop…
Q: Suppose that the first number of a sequence is x, where x is a non-zero positive integer. We define…
A: Program in C++ to print sequence of number for the case defined in the statement above
Q: 9. Write a program to print out all Armstrong numbers between 1 and 500. If sum of cubes of each…
A: Since the programming language isn't mentioned, we will use the C language We will run a loop to…
Q: A Fibonacci sequence is a sequence of numbers where each successivenumber is the sum of the previous…
A: We need to find the nth Fibonacci number where the n is the value given by user
Q: The ancient Greeks classified numbers geometrically. For example, a number was called "triangular"…
A: A number is said to be a triangular number if the sum of the dots in the number is equal to the sum…
Q: Write a program that shows the growth of money that occurs in a savings account. Your program should…
A: Program code: #prompt the user to enter initial balance initialBalance=int(input("Enter initial…
Q: Write a program to read two integers with the following significance. The first integer value…
A: Required: Write a program to read two integers with the following significance. The first integer…
Q: Write a program that reads a person's first and last names, separated by a space. Then the program…
A:
Q: Write a program that calculates the number of hours, minutes, and seconds in N seconds. Example: In…
A: The above question is solved in step 2 :-
Q: Please help me solve this problem
A: Note: The Python program is coded as the user requirements.In Python, code indentation is very…
Q: Write a program that reads two integers, a and b, from the user. Where a is equal to 17 and b is…
A: Note: Below is the required program in the python language. Program Approach: Ask the user to enter…
Q: Write a program with total change amount as an integer input, and output the change using the fewest…
A: Find the required code in python given as below and output :
Q: Write a program whose input is a character and a string, and whose output indicates the number of…
A: class GF{ public static int count(String s, char c) { int res = 0; for (int i=0; i<s.length();…
Q: Write a program to prompt the user for their age. Based on their age print out which generation they…
A: If age>21 and age<36 You are generation millennials. Youth ends at 40, old age begins at 59.…
Q: shows how to write a program to factor a polynomial of the form x² + bx + c, where b and c are…
A: #include <iostream>#include <cmath>using namespace std;int main() {float a, b, c, x1,…
Q: • write a program that reads two integer values from the user and then prints the Greatest Common…
A: We know that gcd of two number is (a*b)/LCM(a,b), where a and b is given number.
Q: Given a sequence of N input number variables, where itself is an input variable number, write…
A: PseudoCode for the minimum number in N input numbers:
Q: Write a program whose input is a character and a string, and whose output indicates the number of…
A: import java.util.Scanner;public class Library{ public static int calcNumCharacters(String…
Q: Suppose that the first number of a sequence is x, where x is a non-zero positive integer. We define…
A: #include <iostream>using namespace std; int main(){ char hims; do{ cout…
Q: Write a program that asks the user for the starting value of their number sequence, and the ending…
A: import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new…
Q: Write a program that prints the day number of the year, given the date in the form month-day-year.…
A: Programming Approach Declare a header file. Using namespace. Define function prototypes Declare a…
Q: Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D,…
A: Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D,…
Q: Write a program that reads three numbers and prints "increasing" if they are in increasing order,…
A: Python program to solve the given problem is below.
Q: Python Write a program that calculates and prints the value according to the given formula: Q =…
A: Write a program that calculates and prints the value according to the given formula: Q = Square root…
Q: Write a C program to ask the user to input the name of boy and name of girl. Count the number of…
A: code : #include<stdio.h>int main(){ char boy_name[20],boy_cmn[20]; char…
Q: Write a program for determining if a year is a leap year. In the Gregorian calendar system you can…
A: Answer :
Q: Your program needs to read in two words on a single line. If the pair of words are Super Anagrams of…
A: Here, I have to provide a python solution to the above question.
Q: A. Sum of Others: Write a program called sum_of_others.py Given three numbers x, y, z, determine if…
A: Steps in program: Take x, y, z as input Check using if-elif-else statement whether any two are sum…
Q: Write a program that randomly generates an integer between 1and 12 and displays the English month…
A: We create a variable 'num' to store a random number created. We use a switch-case for each num…
Q: Write a program for determining if a year is a leap year. In the Gregorian calendar system you can…
A: Since programming language is not mentioned, I have done this using Python 3.
Q: Each year the Department of Traffic Accidents receives accident count reports from a number of…
A: Algorithm: Start Implement read_Count() which takes a pointer to an array and its size as arguments…
Q: Write a program that computes the fuel efficiency of a multi-leg journey. The program will first…
A: We need to write a Python program for given scenario.
Q: Given a zero-terminated sequence of non-zero integers in order from smallest to largest, output the…
A: Explanation: #first create a list in python. List = [-10 ,-4,-2,1,5,6,8,9,0] #Then create a variable…
Q: Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D,…
A: Please find the answer below :
Q: There are n players, and counting always starts with the folded hands of player 1. For instance, in…
A: Java Program: // Importing required modules import java.util.Scanner; import java.util.LinkedList;…
Q: Write a program whose input is a string which contains a character and a phrase, and whose output…
A: Hello Student I will explain the whole solution in next stes Please do like :-
Q: Write a program that reads three numbers and prints "increasing" if they are in increasing order,…
A: Please find the answer below :
Q: Write a program that reads the following informa- tion and prints a payroll statement: Employee’s…
A: Lets see the solution.
Q: The goals scored in a soccer match may be inputted as a sequence of ls and 2s terminated by 0. The…
A: The solution to the given question is:- OUTPUT:
Q: Write a program that will compute and display the sum of the factorials of the numbers from 1 to n,…
A: Start Enter number Calculate factorial of number from 1 to n display stop
Exercise G for the do-while Loop
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Write a program that reads student scores, gets the best score, andthen assigns grades based on the following scheme:Grade is A if score is ≥ best -5Grade is B if score is ≥best -10;Grade is C if score is ≥best -15;Grade is D if score is ≥best -20;Grade is F otherwise.The program prompts the user to enter the total number of students, and thenprompts the user to enter all of the scores, and concludes by displaying the grades.Here is a sample run: Enter the number of students: 4 ↵EnterEnter 4 scores: 40 55 70 58 ↵EnterStudent 0 score is 40 and grade is FStudent 1 score is 55 and grade is CStudent 2 score is 70 and grade is AStudent 3 score is 58 and grade is CThe Café Noir Coffee Shop wants some market research on its customers. When a customer places an order, a clerk asks for the customer’s zip code and age. The clerk enters that data as well as the number of items the customer orders. The program operates continuously until the clerk enters a 0 for zip code at the end of the day. When the clerk enters an invalid zip code (more than 5 digits) or an invalid age (defined as less than 10 or more than 110), the program reprompts the clerk continuously. When the clerk enters fewer than 1 or more than 12 items, the program reprompts the clerk two more times. If the clerk enters a high value on the third attempt, the program accepts the high value, but if the clerk enters a negative value onthe third attempt, an error message is displayed and the order is not counted. At the end of the program, display a count of the number of items ordered by customers from the same zip code as the coffee shop (54984), and a count from other zip codes. Also…f. A laborant in a laboratory does a number of antigen tests in one day. Write a program that simulates the number of antigen tests done in a day in a laboratory, displays the number of positives and negatives, and calculates the % of positives in one day. Your program needs to first generate a random number that will show the number of tests done in a day. One laboratory in a day cannot do more than 100 tests and less than 1 (they do at least one). Then for each of the tests, your program needs to generate a random number to show whether they are positive or negative. In order to write this program, you need to have the following three functions used by the main function: test result (void): This function generates a test result. It should randomly return either one or zero. 1 means positive test result and 0 means negative test result. float positive percentage (int,int) : This function takes the total number of positives and the total number of tests and returns the % of positives.…
- JAVA PROGRAMThe goals scored in a soccer match may be input as a sequence of 1s and 2s terminated by 0.The number 1 would mean that team 1 made a goal and 2 would mean that team 2 made a goal.Thus the sequence 1 2 1 2 1 1 2 0 means that Team 1 made 4 goals and team 2 made 3 goals inall. Write a program that would input such sequence and output how many goals each teammade and the result of the match (“Team 1 won”, ”Team 2 won”, “Both tied”). Ensure thatinputs are 0,1 and 2 only.Airline companies apply baggage restrictions for their passengers. An airline company has decided to apply a 10kg limitation for passengers' hand luggage and 20kg for their normal baggage. When passengers arrive, they enter their hand and normal luggage weight from the keyboard. If passengers exceed their normal baggage allowance of 10 dollars per gram, they pay 12 dollars per kg. Accordingly, write the program that calculates the baggage price of the airline they will go to according to the baggage values entered by the arriving passenger and keeps this from closing the program for each passenger. Note: If hand and normal baggage allowances are stretched below the maximum value, the payment amount will be considered not negative. An example printout is given on the right. Geri bildirim gönderWrite a program to calculate the grade point average (GPA) of a student by getting their grades for all their subjects. Grades and their grade points areGrade S 10 pointsGrade A 9 pointsGrade B 8 pointsGrade C 7 pointsGrade D 6 pointsGrade E 5 pointsGrade F 0 pointsThe program should input the number of subjects, followed by the grade obtained in each subject. The program should calculate the average of the grade points and print it.
- USE PYTHON A small shop sells 280 different items. Each item is identified by a 3 – digit code. All items that start with a zero (0) are cards, All items that start with a one (1) are sweets, All items that start with a two (2) are stationery and All items that start with a three (3) are toys. Write a program which inputs the 3 – digit code for all 280 items and outputs the number of cards, sweets, stationery and toys.Python programming In a department store sale, customers who purchase over 2000 are given 10% discount. Write a program that will accept for the purchase amount of a customer, solve for his/her discount if there’s any, ask for the money he/she is going to pay, then output the discounted price and the change of the customer.”A person can obtain their driver's license if they are of legal age and have official identification. Write a Python program that reads a person's age and if they have (y/n) official identification. Output must show whether you can get your license or you can't get it. TicketsThe program will ask for the age of the person, it must be a positive integer. DeparturesAdd the necessary code for the program to print License Granted if you are 18 or older and have official ID, or print You Don't Meet Requirements if you don't meet the license requirements. If the age is negative or the user entered any character other than son when you ask for the ID, it should show the message Wrong Answer The output of the program should be exactly as follows: Example 1 Enter your age: 19 Do you have official identification? (y/n): y License procedure granted Example 2 Enter your age: 19 Do you have official identification? (y/n): nYou do not meet requirements Example 3 Enter your age: 12You do not meet…
- A palindromic number is a number that is the same when written forwards or backwards. The first few palindromic numbers are therefore are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 323 Input a number from the user. Write a program that reverses the digits of a number. Use this program to find if the number is a palindrome. Print if the number is palindrome or not.write a program in python Write a program that will allow a student to enter their name and then ask them to solve 10 mathematical equations. The program should display two random numbers that are to be added, such as: 247 + 129 The program should allow the student to enter the answer. The program should then display whether their answer was right or wrong, and accumulate the right values. After the 10 questions are asked, calculate the average that was correct. Then display the student name, the number correct, and the average correct in both decimal and percentage format. In addition to any system functions you may use, you might consider the following functions: A function that allows the student to enter their name. A function that gets two random numbers, anywhere from 1 to 500. A function that displays the equation and asks the user to enter their answer. A function that checks to see if the answer is correct and accumulates the number correct. A function that calculates the…1. Write a pyrhon program that prints out a classic hangman stick figure. The program should ask the user to enter a number from 1-6 and the corresponding hangman should be printed. The value the user inputs corresponds to the number of incorrect guesses in a real hangman game and so the completeness of the hangman will correspond to the number of ‘incorrect guesses’ inputted by the user (e.g., if the user enters 1, then only the head of the hangman will be printed; full example below). Example:Enter a number from 1-6: 1O Enter a number from 1-6: 2O|Enter a number from 1-6: 3O\||Enter a number from 1-6: 4O\|/|Enter a number from 1-6: 5O\|/|/Enter a number from 1-6: 6O\|/|/ \ 2. Modify your program from problem 1 so that the user input is checked to be a validsingle digit (1-6) before printing the corresponding hangman. If the input is not valid, theninstead of a hangman the following message should be printed “Invalid input: you must enter asingle number from 1-6.” Example:Enter a…