Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

UNIT 3 ACTIVITY 1 A high school volleyball team is selling raffle tickets to raise money for new equipment. The sale will last three

imageimageimageimageimageimageimageimageimageimage

UNIT 3 ACTIVITY 1 A high school volleyball team is selling raffle tickets to raise money for new equipment. The sale will last three days and the tickets cost one dollar. Each team member is required to record the number of tickets they sell each day. The captain of the volleyball team would like a raffle ticket sales program that will allow her to enter each team member's daily ticket sales and calculate the total ticket sales made by the team. She also thinks it would be a good idea to give team members special prizes based on the total number of tickets they sell. So, the program should also display the total tickets sold by each member and the prize they earned. The prizes for different ticket sales levels are shown below: TABLE 1 Prizes 0 Tickets Sold 1 - 10 11 - 20 21 - 30 31 - 40 41 or greater No prize Cup holder Plastic mug Miniature volley ball Team tee shirt Team sweat shirt Prize Program Input: The program will accept the following input: Team Member First Name Day 1 Ticket Sales Day 2 Ticket Sales Day 3 Ticket Sales Program Output: The program will display a message with the team member's name, total ticket sales, and prize earned. Part 1 To complete Part 1 of this activity, follow the steps below: Step 1 Login to your PythonAnywhere account at https://www.pythonanywhere.com/login/ Step 2 Click on the PythonAnywhere logo at the top left of the screen to return to your Dashboard Step 3 Click on the Files link on the menu at the top right of the Dashboard page pythonanywhere. Send feedback Forum Help Blog Account Logout Dashboard Consoles Files Web Tasks Databases Step 4 Create a new Python program file called ticketSales.py (remember the .py at the end of your program name tells your interpreter this is a Python program file). ticketSales.py Step 5 Click on the New File button New file Step 6 Enter the following Python instructions below for your program-be sure to put the # sign in front of each of the comments used to document your program. 1 HNm tin rao am to A 98 NNN Nam 2 3 4 5 6 7 8 9 10 12 13 11 while getMoreSales == "y": 14 15 16 17 18 19 20 22 23 24 25 21 #Get sales information 26 27 #This program calculates the total sales by team member for #The program awards team member prizes based on total ticke #Team member total sales and prize awards are printed to the #The program terminates when the user does not enter a 'y' 28 getMoreSales = "y" teamSales = 0 29 #Create a while loop to process all of the team members # Set starting values for program variables dayOneSales = 0 dayTwoSales = 0 dayThreeSales = 0 memberSales = 0 prizeEarned = ". print(" ") teamMember Name = input("Enter the team member's first na dayOneSales = input("Enter the day 1 ticket sales ") day TwoSales input("Enter the day 2 ticket sales ") dayThreeSales = input("Enter the day 3 ticket sales ") memberSales = int (dayOneSales) + int(day TwoSales) + int teamSales = (teamSales + memberSales) = 30 31 #Determine Prize based on total tickets sold y ay ay $ 556 % % w w w x 32 33 34 35 36 37 41 42 44 45 48 49 50 51 52 53 54 56 57 58 59 if memberSales >= 41: prizeEarned = 'Team Sweat Shirt!' elif memberSales >= 31: prizeEarned = 'Team Tee Shirt!' elif memberSales >= 21: prizeEarned = 'Miniature volley ball!' elif memberSales >= 11: prizeEarned = 'Plastic mug!' elif memberSales >= 1: prizeEarned = 'Cup Holder!' else: prizeEarned = "Team members must sell at least one print (teamMemberName, "sold ", str(memberSales), tic if memberSales > 0: print("prize awarded is: ", prizeEarned) else: print (prizeEarned) #Check if program should end else: getmoreSales = input ("enter y to enter more sales or n n #At the end of the program print total sales for the team print("The total ticket sales for the team were: , str Step 7 Save and Run your program H Save Save as... If you have errors: Look carefully at your code to make sure you have typed it correctly and that you have quotes after all string values. >>> Run Make sure you don't have a typo in your variable names Make sure you have opening and closing parenthesis Make sure you have a # sign in front of each comment Once you have found the error and fixed it, be sure to Save your code and then Run it again. Keyboard shortcuts: Normal and run again Share H Save Save as... >>> Run Testing Your Program You can use the sample input for below to test your program. If you coded your program correctly, it should generate the total ticket sales and prize information shown below: TABLE 2 Sample input Day 1 Day 2 Sales Sales Name Melanie Jacob Sarah Justin Amber 35 20 5 15 7 10 10 7 5 5 5 5 2 5 2 Day 3 Sales Total Sales 50 35 14 25 14 Prize Team sweat shirt Team tee shirt Plastic mug Miniature volley ball Plastic mug If you coded your program correctly, you should see the following output for Melanie: Enter the team member first name Melanie Enter the day 1 ticket sales 35 Enter the day 2 ticket sales 10 Enter the day 3 ticket sales 5 Melanie sold 50 tickets prize awarded is: Team Sweat Shirt! enter y to enter more sales or n to end the program A Few Things to Note about Activity 1 Part 1 Line 6 sets the getMoreSales variable to a starting value of y! This variable is used to control the while loop that starts on line 11. Because the while loop is a pre-test loop, it must have a starting value of 'y' to loop the first time. Lines 25-27 uses the Python input function to get the ticket sales for each of the three from the keyboard. Remember the results from the Python input instruction are in a string format. Line 28 has the following instruction: memberSales = int(dayOneSales) + int(day TwoSales) + int(day ThreeSales) This instruction converts the dayOneSales, dayTwoSales and dayThreeSales variable values obtained from the input function to integers that can be used in addition. Lines 33 - 42 use if and elseif instructions to determine the member prizes based on the number of tickets sold. Part 2 The school principal has purchased FAST STARTER! Buttons for volley ball team members that sell over 30 tickets on the first day of the raffle ticket sale. To complete the second part of this activity, you will modify the your ticketSales.py program to calculate the total tickets sold on the first day of the raffle. The program should print the team member's name and that they get a FAST STARTER! button for selling more than 30 tickets on the first day. Hint: For Melanie, the output would be as follows: Enter the team member's Enter the day 1 ticket first name Melanie sales 35 Enter the day 2 ticket sales 10 Enter the day 3 ticket sales 5 Melanie sold 50 tickets prize awarded is: Team Sweat Shirt! Melanie gets a FAST STARTER! button for selling 35 tickets on the first day! enter to enter more sales or n to end the prog Submit your work Submit your Python file by clicking the Share button in the upper right corner. Then click the Get sharing link button. Then, click on the clipboard icon next to the link to copy it. Paste the link into this activity's dropbox to submit. TABLE 3 Grading Rubric Program Formatting Program comments Program Output Meets Display Requirements Full Credit The program uses proper indentation for all functions, while loops, and conditional logic. The program is fully documented using comments. Program correctly and completely displays team member's name, total ticket sales and prize earned using the test data provided without warnings. Partial Credit The program uses proper indentation for most of the functions, while loops, and conditional logic. The program uses some comments. Program correctly displays some of the required output using the test data provided with some warnings. Little Credit The program does not use proper indentation for functions, while loops, and conditional logic. The program does not use comments. Program does not display required output and has multiple errors and/or warnings.

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

Microeconomics An Intuitive Approach with Calculus

Authors: Thomas Nechyba

1st edition

538453257, 978-0538453257

More Books

Students also viewed these Programming questions

Question

Summarize group psychotherapy outcome research.

Answered: 1 week ago

Question

Fully associative caches have no conflict misses. True False

Answered: 1 week ago