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
done in c++
Write a program that asks for a user's name and age, finds the ticket price based on the age, and prints out the user's name, age, and ticket price.
The program must define the following 3 functions and call them in the main function.
- Create a function called getName that takes in no arguments and returns the name of the user.
- Create a function called getAge that takes in the argument age and uses pass-by-reference to set the age of the user. Ensure that the user cannot put in an age that is negative or greater than 100.
- Create a function called printTicket that takes in the user's name and age and does the following
○ If they are less than or equal to 13 years old set ticket_Price to 9.99.
○ If their age is greater than 13 and less than 65, set ticket_Price to 19.99.
○ If their age is greater than or equal to 65, set ticket_Price to 12.99.
○ Output to the console the user's name, age and ticket price.
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 3 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
- Function 3: Volume of Cylinder function three (radius, height) Create a JavaScript function that meets the following requirements: Receives two parameters, one representing a radius value, the other a height value The function can safely assume, all parameters passed are represented in meters (m). The function calculates the volume of a cylinder and returns the value back to its caller. The function always displays the calculated volume, rounded to two significant digits The function displays the calculated information (console log) as illustrated below: The function returns the calculated volume back to the caller Calling _three(5, 25) The calculated volume is: 1963.50 Calling _three(0, 25) The calculated volume is: 0.00 Calling _three(-5, 25) Radius and height must be greater than 0arrow_forwardCMPSC121: Intro to Programming Techniques gts Objectives After this lab assignment, students should be able to: • Write functions according to specified prototypes Instructions Define a function named reverse that: • Reverses the case of each letter in the first word of a string: o Lowercase letters become uppercase letters o Uppercase letters become lowercase letters • All other characters are left alone • You MUST use the following function prototype: string reverse (string); • HINT: you may use functions from the cetype library: isupper, islower, toupper, and tolower In the main function: • Ask the user to enter a sentence of their choice; the string may contain spaces • Use the reverse function to modify the user's string • Print the modificd string Sample Output Please enter a string below: McGyver premiered in 1985. Your modified string: MCGYVER premiered in 1985. Please enter a string below: Bedford-Stuyvesant, Brooklyn is called Bed-Stuy. Your modified string:…arrow_forward2. a. Function Description: The Python function is mortgage() It receives 2 parameters (salePrice, creditScore ) from the program that invokes it.. The first is a float; the second is an integer. The function's purpose is to determine whether the customer meets the minimum standard to be considered for a mortgage. The sale price needs to be under $1,000,000 and the Credit Score needs to exceed 600 points. The function returns a message stating whether the customer meets the minimum standard and why. Fill in the following function table. Function Name Purpose Required Inputs Expected result 2.b Write the function code 2.c Write the Python program code to input salePrice and creditScore. The code will invoke the mortgage() function with this print statement: "print (mortgage (salePrice, creditScore))" 2.d Test your program: program using various inputs, such as the person's creditScore was too low but the salesPrice was fine; vice versa; or both scores too low. Show that your program's…arrow_forward
- Using pycharm/pythonarrow_forwardpython use Functionsarrow_forwardLISP Function help please LISP Programming only A function that generates a random day of the week, then displays a message saying that "Today is ... and tomorrow will be ...". Then use the built-in function random first to generate a number between 0 and 6 (including). The expression (random) by itself generates a random integer. You can call it with one parameter to return a value within the range from 0 to the value of the parameter-1. For example, (random 10) will return a value between 0 and 9. Next, use the number generated at the previous step to retrieve the symbol for the day of the week from the list. Use the built-in elt. Extract the symbol-name of the day first, then apply the built-in function capitalize to it. Use the result in the princ function call, and do the same thing for the next day. Make the function return true (t) instead of the last thing it evaluates, to avoid seeing the message printed more than once.arrow_forward
- Admission Write a C++ program that: Define a void function named Admission() with two parameters. The function accepts two arguments: a student’s high school grade point average (for example, GPA is 3.2) and an admission test score (for example, 83). The function then displays a message “Accepted” if the student has any of the following: A GPA of 3.6 or above and an admission test score of at least 60. A GPA of 3.0 or above and an admission test score of at least 70. A GPA of 2.6 or above and an admission test score of at least 80. A GPA of 2.0 or above and an admission test score of at least 90. If the student does not meet any of the qualifications, the function should display a message “Rejected”. //for example, here is the function header: void admission (double gpa, int score) Write a function prototype statement for function Admission before the main function, and add function definition after the main function in the program. In the main function, prompts user to enter a…arrow_forwardDefine the following functions: find_base_area() has two parameters as a prism's base length and base width. The function returns the area of the prism's base. The area of the base is calculated by: find_vol() has three parameters as a prism's base length, base width, and height. The function returns the prism's volume, and uses the find_base_area() function to calculate the prism's base area. The volume is calculated by: Ex: If the input is: 4.0 2.0 3.0 then the output is: Prism base length: 4.0 Prism base width: 2.0 Prism height: 3.0 Base area: 8.0 Volume: 24.0arrow_forward7. 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. Invalid values are rejected and the user should be prompted to enter a valid value between 0 and 100. 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 Python program 90-100 80-89 70-79 60-69 Below 60arrow_forward
- /* Programming concept: structures Program should: be a C program, define a structure to store the year, month, day, and high temperature. write a function get_data that has a parameter that is a pointer to a struct and reads from the user into the struct pointed to by the parameter. write a function print_data that takes the struct pointer as a parameter and prints the data. in main, declare a struct, call the get_data function, call the print_data function. */ #include <stdio.h> int main(int argc, char *argv[]) { return 0;}arrow_forwardWhich statement of the following is the most appropriate? Group of answer choices One good method for specifying what a function is supposed to do is to provide a precondition and postcondition for the function. One good method for specifying what a function is supposed to do is to provide a precondition and postcondition for the function. These form a contract between the programmer who uses the function and the programmer who writes the function. Using the assert function to check preconditions can significantly reduce debugging time, and the assertion-checking can later be turned off if program speed is a consideration. One good method for specifying what a function is supposed to do is to provide a precondition and postcondition for the function. These form a contract between the programmer who uses the function and the programmer who writes the function. Using the assert function to check preconditions can significantly reduce debugging time, and the…arrow_forwardWhen a function accepts several arguments, how important is it what order those arguments are sent 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