Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This project is for Python 3.5.2 version. Create a program that will determine the cost per 3 serving for a giant sub sandwich you will

This project is for Python 3.5.2 version.

Create a program that will determine the cost per 3" serving for a giant sub sandwich you will be ordering for a get-together with your friends.

Within main(), get the input of the length in inches for the sub and the cost.

Create function named numServings() that will receive the length in inches and return the number of servings. Each 3" is considered a serving. Servings should be a whole number, so you will need to find a way to drop the fraction and return only the integer portion. You should call this function from within main() AND return the number of servings to main().

Then create a function named costPerServing(). This function which will receive both the cost of the giant sub and the number of servings. This function will return the cost per serving. Call the function from within main().

Then, within main(), print the cost per serving using this format: $2.98 AND print the number of servings! Test data: Enter 46 inch sub for $40 - your program should print 15 servings at $2.67 per serving.

THEN, put the code in main() inside a loop. The loop will ask the user if they want to enter information for another sub sandwich. If so, data is requested and everything including the print statements process again!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago