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
For this portion of the lab, you will reuse the program you wrote in Lab 4. Redesign this solution using functions. For this lab:
- You will define a function names main().
- You will get input in the main function and pass it to the following functions:
- milesToKm()
- FahToCel()
- GalToLit()
- PoundsToKg()
- InchesToCm().
- Each function will require that you have a local variable to store the result of the calculation. This result will then be displayed using the print statement from within the function.
Part 1B: Code
Use the design you created in part A. Write a complete and syntactically correct Python program. Use the IDLE
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 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- 60 points Write a function which takes one parameter int num, and prints out a countdown timer with minutes and seconds separated by a colon (:). It should print out one line for each second elapsed and then pause one second before printing out the next line. After it has done all of this, it should call a special function ringAlarm () to sound an alarm. A few things to note: - You can assume that calling the function sleepytime () makes the program pause for one second - You can assume that calling the function ringAlarm () makes the program sound an alarm - It should count down from num minutes:zero seconds to zero minutes:zero seconds - Your function must have the following signature: void timer (int num) You do not need to demonstrate calling this function from main(). You don't need to format the output nicely; the below is acceptable output for calling this function when num is 10: 10:0 9:59 9:58 //...and so on, all the way down to: 9:1 9:0 8:59 8:58 //..and so on, all the way…arrow_forwardPlease help with the assignment! Language is C. Answer as simply as you can as it is an Intro to C class. Write two functions, total_product and total_sum. Both functions return an integer. Total_product function takes in a 2D array of integers along with an integer with the number of rows and columns. This function will return an integer with the product of the sum of the rows. See example for details. The total_sum function takes in an array of integers with the size of the array. The total_sum function will find the sum of the 1D array. You must call the total_sum function in the total_product to receive full credit. Example: row/column 0 1 2 3 total_sum(row) Result 0 1 2 3 4 10 1 5 6 7 8 26 Given this 2D array above, the answer for total_product would be 260. Because row one adds up to be 10, and row two adds up to be 26. We multiple this together to get total product.arrow_forwardWrite in C++ Sam is making a list of his favorite Pokemon. However, he changes his mind a lot. Help Sam write a function insertAfter() that takes five parameters and inserts the name of a Pokemon right after a specific index. Function specifications Name: insertAfter() Parameters (Your function should accept these parameters IN THIS ORDER): input_strings string: The array containing strings num_elements int: The number of elements that are currently stored in the array arr_size int: The number of elements that can be stored in the array index int: The location to insert a new string. Note that the new string should be inserted after this location. string_to_insert string: The new string to be inserted into the array Return Value: bool: true: If the string is successfully inserted into the array false: If the array is full If the index value exceeds the size of the arrayarrow_forward
- How to call function using pointer. Please Explain with Code Example?arrow_forwardOver the years, people have created a few nicknames for me. One that sticks without me telling me to call me that name is "Denck." It works great with anyone whose name ends with an "er". We are going to create a function called "nickName" which takes in one parameter. This parameter stores the name you want to create the nickname for. If the name ends with an er, return the name with the er removed. If the name does not have an er then return the full name back to the program.arrow_forwardYou should not import anything from an external library in the work , The math module has a function, factorialarrow_forward
- It is necessary to offer a description of the function known as GetStdHandle.arrow_forwardFor Assignment 5, you will design and write a program that covers the following topics: Functions, Vectors, Structures, and Classes. Functions & Passing Variables: Write a different function for each type of variable used. The functions should provide some sort of output through a cout or return value. Normal variable: Passing a variable by value to a paramater of a function. Show that this only makes a copy of the variable passed to it. Normal variable with a default value: Set a default value for a function parameter. Show how the default value gets used. Reference variable: Passing a variable by reference to a parameter of a function. Show how a reference variable can change the value of variable in main(). Show how the use of const can make a reference variable safer (think of it in terms of read/write). Pointer variable: Passing an address of a variable to a parameter of a function. Show how a pointer can change the value of a variable in main(). Show…arrow_forwardWhat is a stub? Group of answer choices A stub is an inline function with a single line that simply sends a "Hello" message to others, indicating that it has been activated. A stub is a function that has an empty body. It will be developed later. A stub is an inline function with a single line that simply increases the pass in value by one. A stub is a function with a single line that simply prints the name of the function, indicating that it has been activated. A stub is a short function that will generate an error message.arrow_forward
- Define stubs for the functions get_user_num() and compute_avg(). Each stub should print "FIXME: Finish function_name)" followed by a newline, and should return -1. Each stub must also contain the function's parameters. Sample output with two calls to get_user_num() and one call to compute_avg(): FIXME: Finish get_user_num() | FIXME: Finish get_user_num() FIXME: Finish compute_avg() Avg: -1 354684.2266598.qx3zgy7 2 Your solution goes here ''' 4 user_num1 5 user_num2 6 avg_result get_user_num() get_user_num) compute_avg(user_num1, user_num2) 8 user_num1 9 user_num2 10 avg_result %3D 11 12 print('Avg:', avg_result)arrow_forwardUrgent Answer plzzarrow_forwardAdd 3 parameters to each function in the code below. ********************************************* Code starts here ************************************************** Module.py #Defination to sort the list def sort(listNum): sortedList = [] #While loop will run until the listNum don't get null while(len(listNum) != 0 ): #Set the min as first element in list min = listNum[0] #iterate over the list to compare every element with num for ele in listNum: #If element is less than min if ele < min: #Then set min as element min = ele #append the sorted element in list sortedList.append(min) #Remove the sorted element from the list listNum.remove(min) return sortedList #Function to find the sum of all elements in list def SumOfList(listNum): #Set the sum as zero sum =0 #Iterate over the list to get every element for ele in…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