Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
8. Write a function with one parameter. The function should accept the value of a radius as its argument and return the volume of the sphere with that radius. Note that the radius may be a decimal fraction. The function should not read or print anything.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images
Knowledge Booster
Similar questions
- After a function calculates a value, how does it return that value to main program where it was called? A. By including that value in a return statement. B. By using the print() function C. By storing the value in a local variable. D. Since function variables are destroyed when the function call is completed, the calculated values are destroyed as well. Which of the following statements are true about functions? A. Functions are a means to re-use code B. Using functions can help make your programs modular C. Functions make maintenance easier D. all of the above The randint() function A. is a built-in function B. built-in data type C. belongs to the random module D. alternate function What happens after a function has been called and the code in the function body has been executed? A. The function is defined. B. Program execution jumps to the function definition and executes the code in the function body. C. The function is destroyed. D. Program…arrow_forwardWhen passing a variable to a function how should the variable be passed? a. Variables can't be passed to functions b. Either ByVal or ByRef (it doesn't matter) c. ByVal d. ByRefarrow_forward5 Variables that are declared outside the body of any function are called what?arrow_forward
- *DONOT USE CHATGPT, please put comments so i can understand. It’s a C language program with algorithm.arrow_forwardWrite a function definition that can compute the force of gravity between two given objects, where "m1" is the mass of object 1 and "m2" is the mass of object 2. The distance between the two objects is "d". The formula for the calculation is as followed: F = G ™i m2 d? The function should accept "m1," "m2," and "d" as parameters with appropriate data types and return the calculated value of "f". Assume "G" is equal to 6.67430 × 10-11. Edit View Insert Format Tools Table 12pt v Paragraph v. BIUarrow_forwardThis question has 2 parts, in part A you will write a function and part B need to implement the function Part A - Write a function called getDistance. This function will have 2 parameters: first is the speed of the object in miles per hour the second is time traveled in hours. The function will return the distance traveld by multiplying the speed by the time passed by parameter. Part B will be a small program that will input the speed and time traveled by 2 vehicles. It will then print which vehicle traveld the furthest and must utilize the function written in part A appropriately. Complete the starter file below (copy and paste into your answer). #write your function here def main(): vehicle1_speed = int(input("Enter the speed of vehicle 1: ")) vehicle1_time = int(input("Enter the time vehicle 1 has traveled: ")) vehicle2_speed = int(input("Enter the speed of vehicle 2: ")) vehicle2_time = int(input("Enter the time vehicle 2 has traveled: "))…arrow_forward
- The function printGrade in Example 6-13 is written as a void function to compute and output the course grade. The course score is passed as a parameter to the function printGrade. Rewrite the function printGrade as a value-returning function so that it computes and returns the course grade. (The course grade must be output in the function main.) Also, change the name of the function to calculateGrade. The function printGrade has been posted below for your convenience. void printGrade(int cScore) { cout << "The course grade is: "; if (cScore >= 90) { cout << "A." << endl; } else if (cScore >= 80) { cout << "B." << endl; } else if(cScore >= 70) { cout << "C." << endl; } else if (cScore >= 60) { cout << "D." << endl; } else { cout << "F." << endl; }arrow_forwardCan i please get help with this, thanksarrow_forward1. Write function printGrade in void function to compute and output the course grade. The course score is passed as a parameter to the function printGrade. (The program will take 5 inputs for 5 subjects. And show the grade of each subject. And calculate the CGPA) TTTE Percentage Score Quality Point Renark Letter Grade 8e - 100 75 - 79 70- 74 65- 69 6e- 64 55- 59 se - 54 45 - 49 40 - 44 35 - 39 e. 34 Excellent Extrenely Good Very Good Good Fairly Good Satisfactory Quite Satisfactory Poor 4.00 3.67 3.33 3.00 2.67 2.33 2.e0 1.67 1.33 Very Poor Extremely Poor Fail 1.00 Expected Output: Inputs 1. Mark for the programming is: 2. Mark for the Math is: 80 85 3. Mark for the Database System is: 4. Mark for the Software Engineering is: 5. Mark for the Business Fundamental is: 74 76 65 Output Letter Grade for Programming: A Letter Grade for Math: A Letter Grade for Database System: Letter Grade for Software Engineering: Letter Grade for Business Fundamental: Remark: B+ A- в Extremely Good 2.…arrow_forward
- For each of the 4 functions below, Re-code each one to make it programmer friendly, using standard coding conventions, and documentation. Document each function with: a description of what it does (one sentence) and how it works (no more than 3 sentences). Also, provide a precondition: and a postcondition: statement. (See example for the setTime function below.) 1. 2. setTime(int hours, int minutes, int seconds); //Function to set the time //The time is set according to the parameters //Precondition: All parameters are valid numbers, within the range of clock hours (1-12), minutes (0 - 59), and seconds (0 - 59). //Postcondition: The clockType instance stores the hours, minutes and seconds. // If any of the parameters are not valid the time values will be set to zeros. int _1 (double x) {return (int) (x + 0.5); }; int _2 (char* s) {char*t = s; while (*t!='\0') {t++; }return t-s;}; 3. long 3 (int x,int y) {long n=1; for (int i = 0;i < y;i++) {n*=x; } return n; };arrow_forward6. Write a function called tallEnough() that takes a single parameter, the user’sheight in inches. If the height is 48 or more, the function should return “You can go onthis ride.” Otherwise it should return the string “Sorry, you’re not tall enough.”>>> tallEnough(46)"Sorry, you're not tall enough.">>> tallEnough(48)'You can go on this ride.'arrow_forwardExercise 4 A number, a, is a power of b if it is divisible by b and a/b is a power of b. Write a function called is_power that takes parameters a and b and returns True if a is a power of b. Note: you will have to think about the base case.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education