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
Concept explainers
Question
in c++ please
A liter is 0.264179 gallons. Write a
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 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
- In C++ ONLY Create a function called QuadraticFormula that takes in a,b, and c and does the quadratic formula. It should first check that b2- 4ac is not negative; if it is negative, end the program. If it is not, output to the console the two solutions.arrow_forwardWrite a function called factorial that computes the factorial of a given number x passed in as an argument. By default it returns the factorial of 6, which is 720. It also takes a optional boolean argument called 'to_print'. If to_print is True, the factorial value is printed instead of being returned. It is False by default, meaning the result is returned, not printed. >>> result = factorial()>>> print(result)Output: 720>>> result = factorial(to_print = True)Output: 720>>> print(result) Output: # no output>>> result = factorial(4)>>> print(result) Output: 24>>> factorial(4, to_print = True)Output: 24>>> print(result) Output:arrow_forwardThe prompt asks: Write a function that calculates the amount of money a person would earn over a period of years if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should ask the user for the number of years and call the function which will return the total money earned in dollars and cents, not pennies. Assume there are 365 days in a year. function totalEarned(years) { } var yearsWorked = parseInt(prompt('How many years will you work for pennies a day? ')); alert('Over a total of ' + yearsWorked + ', you will have earned $' + totalEarned(yearsWorked));arrow_forward
- Write a program that calculates the area (a) of a triangle given two values b (base) and h (height) and using the formula area = (base * height) / 2 .The program should include a function called calculate_area which has two input parameters(b and h) and one output parameter (a).The user is prompted to enter two input values that will be used as base (b) and height (h) thenthe function calculate_area uses those two values as input parameters returns the calculatedarea (a) as an output parameter. After using the function calculate_area the program shoulddisplay the calculated area (a).Hint: use a pointer for the output parametearrow_forwardWrite in Python Write a function named max that accepts two float values as arguments and returns the value that is the greater of the two. For example, if 7.2 and 12.1 are passed as arguments to the function, the function should return 12.1. Use the function in a program that prompts the user to enter two float values. The program should display the value that is the greater of the two.arrow_forwardWrite a function that calculates the amount of money a person would earn over // a period of years if his or her salary is one penny the first day, two pennies // the second day, and continues to double each day. The program should ask the // user for the number of years and call the function which will return the total // money earned in dollars and cents, not pennies. Assume there are 365 days // in a year. function totalEarned(years) {arrow_forward
- using c++arrow_forwardWrite a set of functions that calculate the cost of movie tickets for a family. Using a loop, keep asking: The age of the movie goer. Based on this age, you will charge them these amounts: Under age 3, the ticket is free. If they are between 3 and 12, the ticket is $10.25. If they are over age 12, the ticket is $15.50. If they are 55 or older, the ticket is $12. If they buy at least 4 tickets, they receive a 20% discount. Then, keep a running_total that is output to the screen after each age has been entered. This running_total should be accessed through the functions using a pass-by-reference variable: &running_total The other function parameter variables are to be pass-by-value. Tell them to enter a zero when they want to stop. Finally, calculate the total cost including a 7.5% sales tax. and output it to the screen. Be sure that the code is broken up into functions with good comments. Put as little code in main() as you can get away with and still make sense.…arrow_forwardOne lap around a standard high-school running track is exactly 0.25 miles. Define a function named laps_to_miles that takes a number of laps as a parameter, and returns the number of miles. Then, write a main program that takes a number of laps as an input, calls function laps_to_miles() to calculate the number of miles, and outputs the number of miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print (f' {your_value:.2f}') Ex: If the input is: 7.6 the output is: 1.90 Ex: If the input is: 2.2 the output is: 0.55 The program must define and call the following function: def laps_to_miles (user_laps) 461710.3116374.qx3zqy7 LAB ACTIVITY 1 # Define your function here 21 3 00 Jo UAWN P 4 if ___name__ 5 6 7.8.1: LAB: Track laps to miles 7 8 main.py '__main__': # Type your code here. Your code must call the function. 8/10 Load default template...arrow_forward
- Write a program that will read in the number of liters of gasoline consumed by the user’s car and the number of miles traveled by the car, and then output the number of miles per gallon the car delivered. Yourprogram should allow the user to repeat this calculation as often as the user wishes. Define a function to compute the number of miles per gallon. Your program should use a globally defined constant for the number of gallons per liter. Note: A liter is 0.264179 gallons. An example run of the program is shown below: Hints:1. What will your function do? Document that in the comment.2. What are the parameter(s) to the function? What type? What type is the returned value?3. What kind of a loop should you use? What’s the minimum number of times the user will go through theloop? How to write a function1) Determine the type and number of parameters2) Determine the type of the return value3) Declare the function (usually at the top of the program)4) Write the function (usually at the…arrow_forwardA liter is 0.264179 gallons. Write a program that will read in the number of liters of gasoline consumed by the user’s car and the number of miles traveled by the car and will then output the number of miles per gallon the car delivered. Your program should allow the user to repeat this calculation as often as the user wishes. Define a function to compute the number of miles per gallon. Your program should use a globally defined constant for the number of liters per gallon.arrow_forwardCreate a c++ program that asks the user to enter all of his 3 quizzes during the preliminary coverage. The program would then compute the average of these 3 quizzes. Afterwards, the program would ask the user again to enter 3 quizzes for his/her midterm coverage. The program again would compute the average for the quizzes for the midterm coverage. Use the math function max() to find out which of the two average grades are highest. Example: Please enter 1st prelim quiz: ____ Please enter 2nd prelim quiz: ___ Please enter 3rd prelim quiz: ___ Please enter 1st midterm quiz: ____ Please enter 2nd midterm quiz: ____ Please enter 3rd midterm quiz: ____ The average of your quizzes in prelims and midterms are: 93 for prelims and 97 for midterms. 97arrow_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