Step 1: Write a function that takes as input the following parameters: 1. The gender of the child 2. The height of the mother in inches 3. The height of the father in inches The function should return the estimated height of the child in inches as an integer. Your function should use the following formulas to give the correct answer based on the gender of the child: - Height of male child: ((Mother’s height * 13/12) + Father’s height) / 2 - Height of female child: ((Father’s height * 12/13) + Mother’s height) / 2 Convert the height of the child to an integer. The above formulas will give you a floating point number so be sure to convert to a whole number

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Step 1: Write a function that takes as input the following parameters:
1. The gender of the child
2. The height of the mother in inches
3. The height of the father in inches
The function should return the estimated height of the child in inches as an integer.
Your function should use the following formulas to give the correct answer based on the gender of the
child:
- Height of male child: ((Mother’s height * 13/12) + Father’s height) / 2
- Height of female child: ((Father’s height * 12/13) + Mother’s height) / 2
Convert the height of the child to an integer. The above formulas will give you a floating point number
so be sure to convert to a whole number.

Step 2: Write a function that takes as input the following:
1. The height of the child in inches as an integer
The function should output the height of the child in feet and inches (i.e. 64 inches is 5 feet and 4
inches).



Step 3: Create a main function/program that does the following:
1. The main function should ask the user for the gender of their child.
2. The main function should ask the user for the height of the mother in inches.
3. The main function should ask the user for the height of the father in inches.
4. The main function should then use the function from Step 1 to get the height of the child in
inches.
5. The main function should then use the function from Step 2 to produce the height of the child in
feet and inches.
6. The main function should have a loop so that the user can calculate the heights of as many
children as they wish.

Step 4: Submit your flowchart(s) for each step of the problem. Also, submit your program with good
comments and variable names.
 

Take Problem #1 from the Midterm Exam Study Guide. Turn the program into one that uses functions.
Step 1: Create a function that calculates the subtotal amount for the customer. The function should
have the following parameters:
1. Number of rooms
2. Number of nights
The function will calculate the subtotal amount as:
Subtotal Amount = (number of rooms * number of nights * 112.50)
The function should return the subtotal amount.



Step 2: Create a function to calculate the discount price. The function should have the following
parameters:
1. The subtotal amount
This function will ask the user if they are a new customer. If they are not, the function will return a
discount price of 0. Otherwise, the function will return the discount price:
Discount Price = Subtotal Price * .20


Step 3: Create a function to calculate the total price. The function should take in the following
parameters:
1. The subtotal amount
2. The discount price
The function will calculate the total price as the subtotal minus the discounted price. The function will
return the total price.


Step 4: Create a function to print the user’s receipt. The function should take in the following
parameters:
1. The customer’s name
2.Subtotal amount
 
 
3. Discount price
4. Total price
The function will print/display a receipt on-screen that show’s the customer’s name, subtotal, discount,
and total price. All monetary values should be printed with a “$” in the front of the output and
formatted to 2 decimal places. Do not use round.


Step 5: Create a main function that does the following:
1. Ask the user for their name
2. Ask the user for the number of rooms being purchased
3. Ask the user how many nights they plan to stay
4. Finds the subtotal by using the function from Step 1
5. Finds the discount price by using the function from Step 2
6. Finds the total price by using the function from Step 3
7. Prints the user’s receipt using the function from Step 4

Step 6: Submit your program to Canvas.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Concept of Parenthesis
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
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education