You 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.
Q: n Matlab: Write a function that takes a month, day, and year as inputs and returns the number of…
A: a function that takes a month, day, and year as inputs and returns the number of days that have…
Q: Write a program that calculates the monthly pay for a salesperson. A person's pay is equal to his or…
A: Solution: Note : Complete executable C++ code is attached at "Step-6". 1. Implementation of…
Q: In Python: can you this problem be solved without using "while" and "for". Write a function called…
A: We need to write a program in python that takes the input of an integer between 1 and 50. program…
Q: One lap around a standard high-school running track is exactly 0.25 miles. Write a program that…
A: Programming instruction: Declaring variable. Take input from the user. Call the function which…
Q: An integer number is said to be a perfect number if its factors, including 1 (but not the number…
A: Program Approach- Include the essential header files. Declare the functions needed for the program.…
Q: • Prints on the screen your name, your student ID and your section number. For example, if your name…
A: Here is the approach : In the first part just print everything in format In the second part just…
Q: Write a program whose inputs are three integers, and whose outputs are the largest of the three…
A: Solution :
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: Write a function that determines whether an exam score is valid. The function should return True if…
A: def is_valid_score(score): if (0<score<100): returnTrue else: returnFalse def scorecheck():…
Q: If a year has the digit 7 OR the digit 4 in it, then it is called a “Beautiful year”. For example,…
A: Solution: Define the function called year_cotains() Inside the function declare 4 and 7 of string…
Q: In Coral Language: Write a program whose inputs are three integers, and whose outputs are the…
A: The below-given coral program will obey the following rubrics: Declaring, Function…
Q: A pedometer treats walking 1 step as walking 2.5 feet. Define a function named feet_to_steps that…
A: - We need to code the provided feet to step conversion in python.
Q: Write a program whose inputs are three integers, and whose outputs are the largest of the
A: Here both the function needs to be defined separately to solve the question.
Q: Write a function that simulates a guessing game as follows. The computer will generate a random…
A: Note: Follow proper indentation Comments mentioned in code for understandability Code: import…
Q: A pedometer treats walking 1 step as walking 2.5 feet. Define a function named feet_to_steps that…
A: Answer :
Q: Write a function that prompts the user for the base and the height of a triangle and then proceeds…
A: To find area of the triangle, in python with length of height and base given, we need to first take…
Q: Implement a C function, named triangle, that outputs Pascal's triangle. An example is provided…
A: #include < stdio.h > long factorial(int); int main() { int i, n, c;…
Q: Given two points (x1, y1), (x2,Y2), Manhattan distance is defined as: manhattan = |x2 – x,| + ]y2 -…
A: Python used to answer this question
Q: Write a program whose inputs are three integers, and whose outputs are the largest of the three…
A: largest_number() function finds the largest number by comparing the three numbers. smallest_number()…
Q: Write a function days_in_month() that returns the number of days in a month in C . The function has…
A: Program Approach: Include necessary header files to get the standard I/O. Declare a function…
Q: A pedometer treats walking 1 step as walking 2.5 feet. Define a function named feet_to_steps that…
A: Code: Please the below input for.the answer ..... Take the input from the user in float which…
Q: The new coordinates of a point in the x y plane that is rotated about the z axis at an angle…
A: ANSWER: I have provided the properly commented code in both text and image format so you can easily…
Q: Prints on the screen your name, your student ID and your section number. For example, if your name…
A: Use separate variables to store sum and count and then use conditional statement to check for the…
Q: Pearsall's Pizzeria offers delivery in Bozeman. The total delivery cost is equal to the total cost…
A: Python used to answer this question
Q: In Coral Please Write a program whose inputs are three integers, and whose outputs are the largest…
A: A Coral program is as follows, Function LargestNumber(integer num1, integer num2, integer num3)…
Q: In mathematics, a factorial of a number is calculated by multiplying that number by all of the…
A: The programming language is missing in the question, the below answer is provided in C language. If…
Q: ticular jurisdiction, taxi fares consist of a base fare of $4.00, plus $0.25 for every 140 meters…
A: Lets see the solution.
Q: Write a program that takes as input your gross salary and your total saving and uses another…
A: import java.util.*; public class Main{ public static void main(String[] args) {…
Q: • Prints on the screen your name, your student ID and your section number. For example, if your name…
A: I give the code in C along with output and code screenshot
Q: In this question you need to write a program and execute it with the given input, the output of your…
A: Islamic year for the Gregorian year 1946 is 1364.
Q: In Python: Write a program with total change amount as an integer input that outputs the change…
A: NOTE: - The program prints one coin type per line. Three functions are being used here. def…
Q: We’ll call a number “glorious” if it is not divisible by any number from 10 to 50, inclusive. Write…
A: #note: since programming language is not specified, we are providing answer in pythondef…
Q: rite a function days_in_month() that returns the number of days in a month. The function has the…
A: #include<stdio.h>int days_in_month(int month,int is_leap){ int res=-1; switch(month){…
Q: Objective: A program should be developed to read the value of x. It computes the value of f(x)…
A: Read a float type value x from the user. Using if/else statement checks whether the given input…
Q: Write a function median : int * int * int -> int that returns the median value of the input. You may…
A: fun median(a,b,c) = if a > b if a < c…
Q: Write a function averageDigits that computes the average of the digits of a 3-digit positive number…
A: Here is the c++ program. see below steps.
Q: Write a program that outputs the inflation rates for two successive years and whether the inflation…
A: Include header file <iostream> for input output operation. define function getInput to take…
Q: Write a python program that accepts name of an employee and employee's yearly sales of last five…
A: Required:
Q: Write a program that finds the grade corresponding to the average mark. The program uses a function…
A: Write a program that finds the grade corresponding to the average marks. Answer: #include…
Q: Write a program that takes as input five numbers and outputs the mean (average) and standard…
A: In the solution of problem we use two methods mean() and stdDev() to compute the mean (average) and…
Q: In python.... A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input…
A: Actually, python is a easiest programming language. It is a structural and object oriented…
Q: Write a function number_of_pennies() that returns the total number of pennies given a number of…
A: In Python, a function is a gathering of related statements that plays out a particular errand. It…
Q: = ax2 + bx + c. • Ask the user for the coefficients a, b and c of a quadratic function f (x) Output…
A: Hi, as per the given question, we are given a Python problem along with the code and sample output.…
Q: Write a function that takes a gross salary and calculates the net salary by deducting: • 7.65%…
A: PROGRAM: #include<stdio.h> //Defining the method to calculate the net salary with parameters…
Q: Write a function compute_manhattan_distance(x1,x2,y1,y2) that computes the Manhattan distance…
A: First, we will enter both the coordinates. Then we will pass these coordinates to function…
Q: Write a function that accept integer values for day, month and year and return them in valid format.…
A: Actually, program is a executable software that runs on a computer.
Q: python programming Write a function find_hypot which, given the length of two sides of a…
A: def find_hypot(a, b): # user defined function to calculate…
Q: 9. Write three functions that are the “inverses" of to_secs: (a) hours_in returns the whole integer…
A: def hours_in(s): h = s // (60 * 60) return h
Q: Using the starter code below, write a program that asks a user for two points (x1, y1) and (x2, y2),…
A: We will input the (x,y) pairs for the center point and the perimeter point. Then we will pass all…
Q: About beginner python programming: - Imagine that you want to send a congratulations message and…
A: def displayMessgae(text, n): # user define function to display…
Just a basic
Step by step
Solved in 4 steps with 2 images
- 8: PGandE.cpp) Consider a gas and electric bill that setstwo levels of use as follows:Gas ElectricTier 1 quantities 10.1 therms 558 kwhTier 1 price $1.415 /therm $.223 /kwhTier 2 Price $1.9)32 /therm $.281 /kwhWrite a program that takes starting and ending readingsfor gas and electric meters and calculates charges to thenearest cent. Use one function to calculate charges for bothgas and electric so as to eliminate duplicate calculations pprogram in c++Create a function sumofAllOdd(s,e) that will return the sum of all odd numbers in a range of inputted numbers s (starting number), e(ending number). For example: Test Result sumofAllOdd(22,55) sumofAllOdd(5,10) Answer:(penalty regime: 10, 20, ... %)Answwr asap 9.Write a function hello(firstname, lastname), which, for example, if called with hello('James, 'Barth'), would print two lines: Hello James Barth Hello Barth, James. Use the function in a program where you ask the user for first and last name and then call the function.?
- 1. Write a function that converts a phrase into pig Latin. A word is convertedto pig Latin by removing the first character of the word, placing it at theback of the word, and adding the characters “ay” to the word. For example,“hello world” in pig Latin is “ellohay orldway.” Your function can assumethat each word consists of at least two letters and that each word is separatedby one space, with no punctuation marks.2. Write a function that counts the occurrences of a word in a string. Thefunction should return an integer. Do not assume that just one space separates words and a string can contain punctuation. Write the function sothat it works with either a String argument or a StringBuilder object.3. Write a function that takes a number, such as 52, and returns the numberas a word, as in fifty-two.4. Write a subroutine that takes a simple sentence in noun-verb-object formand parses the sentence into its different parts. For example, the sentence“Mary walked the dog” is parsed into…LAB 10.3 Using getline() & get() Exercise 1: Write a short program called readata.cpp that defines a characterarray last which contains 10 characters. Prompt the user to enter their lastname using no more than 9 characters. The program should then read thename into last and then output the name back to the screen with anappropriate message. Do not use the getline() or get functions! Exercise 2: Once the program in Exercise 1 is complete, run the program andenter the name Newmanouskous at the prompt. What, if anything,happens? (Note that the results could vary depending on your system).Exercise 3: Re-write the program above using the getline() function (andonly allowing 9 characters to be input). As before, use the character arraylast consisting of 10 elements. Run your new program and enterNewmanouskous at the prompt. What is the output?Exercise 4: Bring in program grades.cpp and grades.txt from the Lab 10folder. Fill in the code in bold so that the data is properly read…LAB 10.3 Using getline() & get()Exercise 1: Write a short program called readata.cpp that defines a characterarray last which contains 10 characters. Prompt the user to enter their lastname using no more than 9 characters. The program should then read thename into last and then output the name back to the screen with anappropriate message. Do not use the getline() or get functions!Exercise 2: Once the program in Exercise 1 is complete, run the program andenter the name Newmanouskous at the prompt. What, if anything,happens? (Note that the results could vary depending on your system).Exercise 3: Re-write the program above using the getline() function (andonly allowing 9 characters to be input). As before, use the character arraylast consisting of 10 elements. Run your new program and enterNewmanouskous at the prompt. What is the output?Exercise 4: Bring in program grades.cpp and grades.txt from the Lab 10folder. Fill in the code in bold so that the data is properly read…
- 5.11 LAB: User-Defined Functions: Max and min numbers Coral language only please Define a function named LargestNumber that takes three integers as parameters and returns the largest integer. Define a second function named SmallestNumber that takes three integers as parameters and returns the smallest integer. Then, write a main program that reads three integers as inputs, calls functions LargestNumber() and SmallestNumber() with the inputs as arguments, and outputs the largest and the smallest of the three input values. Ex: If the input is: 7 15 3 the output is: largest: 15 smallest: 3 Your program should define and call two functions:Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNumFunction SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNum6.23 LAB - Flip a coin Define a function named CoinFlip that returns "Heads" or "Tails" according to a random value 1 or 0. Assume the value 1 represents "Heads" and 0 represents "Tails". Then, write a main program that reads the desired number of coin flips as an input, calls function CoinFlip() repeatedly according to the number of coin flips, and outputs the results. Assume the input is a value greater than 0. Output the total number of 'Heads' and 'Tails' Hint: Use the modulo operator (%) to limit the random integers to 0 and 1. Ex: If the random seed value is 2 and the input is: 3 the output is: Tails Heads Tails Total Heads: 1 Total Tails: 2 Note: For testing purposes, a pseudo-random number generator with a fixed seed value is used in the program. The program uses a seed value of 2 during development, but when submitted, a different seed value may be used for each test case. The program must define and call the following function:string CoinFlip() Do Not Delete Any Existing…(Numerical) a. The following is an extremely useful programming algorithm for rounding a real number to n decimal places: Step 1: Multiply the number by 10n Step 2: Add 0.5 Step 3: Delete the fractional part of the result Step 4: Divide by 10n For example, using this algorithm to round the number 78.374625 to three decimal places yields: Step1:78.374625103=78374.625 Step2:78374.625+0.5=78375.125 Step3:Retainingtheintegerpart=78375Step4:78375dividedby103=78.375 Using this algorithm, write a C++ function that accepts a user-entered value and returns the result rounded to two decimal places. b. Enter, compile, and run the program written for Exercise 11a.
- Question 6 # This function checks whether a given number is even or not def isEven(number): """ what it takes? a number what it does? determines if a number is even what it returns? if even, return 1 if odd, return -1 """ # your code goes in here defisEven(number): #check if the number is divisible by 2 by checking the remainder. if number % 2==0: #If remainder is 0, then its divisble by 2 and an even number #hence return-1 return1 else: #if remainder is not 0, it'll be 1, so its NOT divisible by 2 and its an odd number #hence return -1 return-1 Test case for question 6 try: if isEven(5) == -1: score['question 6'] = 'pass' else: score['question 6'] = 'fail' except: score['question 6'] = 'fail' isEven(5)//Write a function that loops through and console.log's the numbers from 1 to 100, except multiples of three, log (without quotes) "VERY GOOD" instead of the number, for the multiples of five, log (without quotes) "SUPER AWESOME". For numbers which are multiples of both three and five, log (without quotes) "VERY GOOD SUPER AWESOME" Console log out: 12VERY GOOD4SUPER AWESOMEVERY GOOD78VERY GOODSUPER AWESOME11VERY GOOD1314VERY GOOD SUPER AWESOME1617VERY GOOD19SUPER AWESOMEVERY GOOD2223VERY GOODSUPER AWESOME26VERY GOOD2829VERY GOOD SUPER AWESOMEC++ QUESTION 2. The following function definition is not perfect. What two errors can you find?int search(int a[n], int numberUsed, int target) {int index = 0; bool found = false; while ((!found) && (index < numberUsed)) if (target = a[index]) found = true; elseindex++;if (found) return index;else return -1;}