Microsoft Word - Program 5.docxCOMS-170: PROGRAM PROGRAM 5: FUNCTIONS OVERVIEW A function is a group of statements that exist within a program to perform a specific task. The goal of both...

Attached file.


Microsoft Word - Program 5.docx COMS-170: PROGRAM PROGRAM 5: FUNCTIONS OVERVIEW A function is a group of statements that exist within a program to perform a specific task. The goal of both functions is to break up code into smaller pieces. By doing so, programs are easier to read and debug. This also can be beneficial for when code needs to be written multiple times within a program. TASK Tommy’s Totally Terrific Teas needs an application that calculates the final price for their fabulous teas. All tea drinks are the same cost so all prices are based on the size of tea ordered. Your task is to create a program that displays the price of the tea ordered and calculates total final price including sales tax. REQUIREMENTS 1. Pseudocode containing: a. A main function that displays a menu of choices. Menu choices are: C: Calculate price for tea D: Display tea price information X: Exit application The menu will display until the user enters X to exit the application. b. A function named DisplayInfo that displays tea prices (see output example below). This function accepts zero arguments and does not return any values. c. A function named CalculateTotal that asks for the size of tea ((S)mall, (M)edium, (L)arge, (J)umbo). This function accepts zero arguments and returns a single value. The value returned is the cost for the selected tea size. d. A function named TaxAmount. This function accepts an argument named subtotal and returns sales tax amount (subtotal * .06). 2. Program written in Python containing: a. A main function that displays a menu of choices. Menu choices are: C: Calculate price for tea D: Display tea price information X: Exit application The menu will display until the user enters X to exit the application. b. A function named DisplayInfo that displays tea prices (see output example below). This function accepts zero arguments and does not return any values. c. A function named CalculateTotal that asks for the size of tea ((S)mall, (M)edium, (L)arge, (J)umbo). This function accepts zero arguments and returns a single value. The value returned is the cost for the selected tea size. Tea prices for each size: Small Tea: $2.99 Medium Tea: $3.59 Large Tea: $4.09 Jumbo Tea: $4.99 d. A function named TaxAmount. This function accepts an argument named subtotal and returns sales tax (subtotal * .06). e. Program includes inline documentation about each section. For example, # declare and initialize variables. f. Program is saved as Program5.py EXPECTED INPUT/OUTPUT This shows the format of the expected input/output. TEST CASES The following test cases will help you verify that your application is working properly. Test Case 1 Test Case 2 Test Case 3 Medium Tea Cost: $3.81 Small Tea Cost: $3.17 Jumbo Tea Cost: $5.29 ASSESSMENT Item Point Value Pseudocode is created in a Word document and displays all processes. 10 Program runs in Python without error (required to earn any points) Yes/No Program includes documentation. 5 Program includes main function that calls itself to redisplay menu. 5 Program includes function named DisplayInfo that accepts zero arguments and returns zero values. The function displays tea price info (provided above). 5 Program includes function named CalculateTotal that accepts zero arguments, gets input from user about their tea size, and returns a float containing their final tea cost. Final tea cost is not printed to screen from this function. 10 Program includes a function named TaxAmount that accepts an argument named subtotal containing a float. The function returns a float which is the sales tax amount (subtotal * .06). Tax is not printed to screen from this function. 10 Program displays output as identified above. 5 TOTAL POINTS 50 * Make Sure both pseudocode document and Python program are submitted for this assignment.
Nov 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here