Concept explainers
Maximum of Two Values
Write a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a
Learn your wayIncludes step-by-step video
Chapter 5 Solutions
Starting Out with Python (4th Edition)
Additional Engineering Textbook Solutions
Starting Out with Programming Logic and Design (4th Edition)
Modern Database Management (12th Edition)
C How to Program (8th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Concepts Of Programming Languages
Starting Out with C++: Early Objects (9th Edition)
- The following statement calls a function named half, which returns a value that is half that of the argument. Write the function named half. result = half(number) %3Darrow_forwardTest Average and Grade - MUST BE WRITTEN IN PSEUDOCODEarrow_forwardTest Average and Grade Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following functions in the program: calc_average. This function should accept five test scores as arguments and return the average of the scores. determine_grade. This function should accept a test score as an argument and return a letter grade for the score based on the following grading scale: Score Letter Grade 90–100 A 80–89 B 70–79 C 60–69 D Below 60 F Write the following functions: getTestScore(): This function prompts user for five test scores and returns test score to the caller. calcAverage(): This function accepts five test scores as arguments and returns the average of the five test scores. determineGrade(): This function accepts an average as an argument and returns a letter grade for the score based on the grading scale. displayData(): This method displays all five…arrow_forward
- 5. Falling Distance determine the distance the object falls in a specific time period: 1 d The variables in the formula are as follows: d is the distance in meters, g is 9.8 - t is the amount of time, in seconds, that the object has been falling. Design a function named fallingDistance that accepts an seconds) as an argument. The function should return the distance, in meters, that the object has fallen during that time interval. Design a program that calls the functiion in a loop that passes the values 1 through 10 as arguments and displays the return value object's falling time (inarrow_forwardH1. A value returning function executes its statements and then returns a value. true or false Explain with details also explain wrong optionarrow_forwardhelppp meee Instructions: You are provided with the isLeapYear() function which is already declared and defined for you. Your task is to ask the user for a year and then call the isLeapYear function to check whether the year is a leap year or not. Input 1. Year to be checked Output should be like this: Enter year: 2020 2020 is a leap year note: If a certain year is a leap year, print "<INSERT_YEAR_HERE> is a leap year" Otherwise, print "<INSERT_YEAR_HERE> is not a leap year" MY CODE: (IN C LANGUAGE PLEASE) #include<stdio.h> int isLeapYear(int); int main(void) { // TODO: Write your code here return 0;} int isLeapYear(int n) { if( (n % 4 == 0 && n % 100 != 0) || (n % 100 == 0 && n % 400 == 0) ) { return 1; } return 0;}arrow_forward
- This statement causes a function to end and sends a value back to the part of the program that called the function.a. endb. sendc. exitd. returnarrow_forwardQuestion 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)arrow_forwardMaximum of two values. Design a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two. Please design a flowchart.arrow_forward
- Feet to Inches Problem One foot equals 12 inches. Use pseudocode to design a function named feetToInches that accepts a number of feet as an argument, and returns the number of inches in that many feet. Use the function in a program that prompts the user to enter a number of feet and then displays the number of inches in that many feet.arrow_forwardComputer Fundamentals and Programming 2 Write a program that determines a student’s grade. The program will accept 3 scores and computes the average score. Determine the grade based on the following rules: - If the average score is equal or greater than 90, the grade is A. - If the average score is greater than or equal to 70 and less than 90, the grade is B. - If the average score is greater than or equal to 50 and less than 70, the grade is C. - If the average score is less than 50, the grade is F. Source Codes and Print Screen of the Outputarrow_forwardProblem definition: A college wants to know how well its students did on an exam. The following program summarizes the results. The program asks a user to enter the results pass (1) or fail (2) for 10 students. It displays the number of passed and the number of failed. It displays a message "Raise error" if the number of passes is more than 8 You are asked to identify statement with syntax errors by selecting them as wrong and the correct statements as rightarrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage