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
Write a function that returns the average of the digits in the even places in an integer using the following header:
double avgOfEvenPlaces(int n)
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 3 steps with 2 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
- Python programming also screenshotarrow_forwardThe following variables have been initialized for you: int a; float f: double d: You have to cast the variable into different data types as follows: • Cast a as float to a variable x. • Cest fas an integer to a varieble y. • Cest d as flost to a variable z. Hint: You nae to initia ize the varlebles xy and z of proper data types. Note: The required code to take user input is already written for you. Similar to value asinput. Sample Input 11 12.2345 12.34567895343534511 Sample Output: =110y-12z=12.3-5679arrow_forwardYou are awesome! Could you do these too please? Q4: Create a function that multiply's two numbers together and outputs the answer. The function must accept 2 parameters. Don't forget about SCOPE if you're using varibles inside of your function. Q5: Using your multiply function, use the shortest amount of code to display the following output on the screen: 1 * 1 = 1 2 * 2 = 4 3 * 3 = 9 4 * 4 = 16 5 * 5 = 25 6 * 6 = 36 7 * 7 = 49 8 * 8 = 64 9 * 9 = 81 10 * 10 = 100 Q6: Determine using a conditional statement, if the following variable is a number or is not not a number. If it is not, try to convert it to a number and use your mult() function to multiply it by 2. NOTE: YOU MAY NOT MODIFY ANY VARIBLES that are Constants. const number = "17";arrow_forward
- PYTHON Question 3: Rain or Shine Part 1: Alfonso will only wear a jacket outside if it is below 60 degrees or it is raining. Write a function that takes in the current temperature and a boolean value telling if it is raining and it should return True if Alfonso will wear a jacket and False otherwise. Try solving this problem with a single line of code. def wears_jacket(temp, raining): """ >>> wears_jacket(90, False) False >>> wears_jacket(40, False) True >>> wears_jacket(100, True) True """ *** YOUR CODE HERE *** Note that it should either return True or False based on a single condition, whose truthiness value will also be either True or False. Part 2: Rewrite the above function with a lambda expression.arrow_forwardFinish the function below that takes in the length of the two parallel sides of a trapezoid a and b, which are separated by a distance h, and returns its area. In [ ]: defarea_of_trapezoid(a,b,h):# YOUR CODE HEREraiseNotImplementedError() In [ ]: """Check that area_of_triangle returns the correct output for several inputs""" assert abs(area_of_trapezoid(3,3, 5) - 15) <=.1 assert abs(area_of_trapezoid(3,4, 5) - 17.5)arrow_forward//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 AWESOMEarrow_forward
- Convert the following statement to a statement that uses the universial quantifier:"There is no largest integer."arrow_forwardFrom: How to Think Like a Computer Scientist: Learning with Python 3 -Chapter 6, Exercise 9 Write three functions that are the “inverses” of to_secs: (a) hours_in returns the whole integer number of hours represented by a total number of seconds. (b) minutes_in returns the whole integer number of left over minutes in a total number of seconds, once the hours have been taken out. (c) seconds_in returns the left over seconds represented by a total number of seconds. My original to_secs function: def to_secs(h, m, s): total = 0 total = total + h * 60 * 60 total = total + m * 60 total = total + s return totalarrow_forwardThe Function will be able to calculate the area of the following polygons: Right triangles, Rectangles, and regular polygons. It will do so by taking the following inputs: - numSides – a double of the number of sides the polygon has - sideLengths – a double of the length or lengths of sides of the polygon The program should determine if the inputs are formatted properly. The rules are: - numSides must be a positive integer number with values greater than or equal to 3. - When numSides is 3 or 4, sideLengths can either be a scalar or an array with two values. - When numSides is greater than 4, sideLengths must be a scalar. To determine if a number is an integer, you can use the rem function. rem returns the remainder of whole number division. It has the following syntax: remainder = rem(numerator, denominator); Where remainder is the remainder of numerator/denominator. To use this to find whether a number is an integer, use rem in the following way: remainder = rem(number, 1); When…arrow_forward
arrow_back_ios
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