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
Concept explainers
Question
"""
MovieGuide.py
This program allows each theater patron to enter a value from
0 to 4 indicating the number of stars that the patron awards
to the Guide's featured movie of the week. The program
executes continuously until the theater manager enters a
negative number to quit. At the end of the program, the
average star rating for the movie is displayed.
"""
# Initialize variables.
totalStars = 0 # total of star ratings.
numPatrons = 0 # keep track of number of patrons
averageStars = 0
numStars = 0
# Get input.
numStarsString = input("Enter rating for featured movie: ")
# Convert to double.
numStars = float(numStarsString)
# Write while loop here
while numStars >= 0 and numStars <= 4:
numPatrons = numPatrons + 1 # incrementor
totalStars = totalStars + numStars
# Get input.
numStarsString = input("Enter rating for featured movie: ")
# Convert to double.
numStars = float(numStarsString)
# Calculate average star rating
averageStars - totalStars / numPatrons
print("Average Star Value: " + str(averageStars))
https://www.youtube.com/watch?v=VH25TRHmdoA&t=484s
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 2 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
- Program Purpose - Professional Athletes often hire other professionals to help take care of matters for them. We will group them in four categories: Lawyers, Personal Assistants, Agents, and Trainers. They all get paid a percentage of the athlete's total yearly salary. Lawyers - 10%, Personal Assistants - 3%, Agents - 7%, and Trainers - 5% . Prompt the user to enter the athlete's salary for the year (ensure that the entered value is positive). The user should then enter the name and category of each of the hired professionals. The athlete should be able to hire as many professionals in each category as he/she wants, even if it is more than he/she can afford. Based on the category, calculate the amount that each professional should be paid. After all data has been entered, print the names of each professional hired, how much each is being paid, the total amount the athlete paid, and how much the athlete has left.arrow_forwardInclude a formula in the last column on the third row to calculate 75% of the Cost. The formula is =0.75*b3. You do not need to select a number format. Include a formula in the next two rows of the same column, adjusting the row reference as necessary.arrow_forwardWhich is correct option for below question. Options are 0,7,none of these. With proper explanationarrow_forward
- assign(self, assignment:Assignment) -> AssignmentResult: """ This function is to simulate the process of the student receiving an assignment, then working on the assignment, then submitting the assignment and finally receiving grade for the assignment. This function will receive an assignment then a grade should be calculated using the following formula: grade = 1 - (Student's current energy X Assignment difficulty level). The min grade a student may receive is 0% (0) After the grade is calculated the student's energy should be decreased by percentage difficulty. Example if the student has 80% (.8) energy and the assignment is a difficultly level .2 there final energy should be 64% (.64) = .8 - (.8 * .2). The min energy a student may have is 0% (0) Finally the grade calculated should be stored internally with in this class so it can be retrieved later. Then an Assignment Result object should be created with the student's ID, the assignment…arrow_forwardBoxPlots are centric to : (Select one) a) mean b) median c) mode d) Q1arrow_forwardCreate the following variables that can be used to store values. Use the naming conventions as outlined in the Algorithms/Pseudocode Guidelines document in the course resources section of the course. 1. test grade for student test 2. total of all test grades added together 3. the average for the test grades Create an assignment statement that sets the value of the variable you created to store the value of all test grades added together to zero. You may refer to Table 6.1 in Chapter 6 for examples. Create an input statement to input the value for the first test grade for the variable you created. Create an algorithm that will obtain the test grade for three students, add the test grades together, calculate the average of the test grades, and output the average. Use a count-controlled loop to create the algorithm. Use the information from your answers to questions 3, 4, and 5 in the creation of your algorithm. Also use information and examples from Chapter 6…arrow_forward
- 16 Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar. var num2 = 32; var num1 = 12; var rem=num2 % num1; while(rem> 0) { num2 = num1; num1 = rem; rem =num2 9% num1; document.write(num1): The output of the document.write statement at the end of this block is Reset Next m. All rights reserved. 5896arrow_forwardSlappy’s Software Sales AssignmentYou have been hired by Slappy’s Software Sales to write a program to figure thetotal cost to customers that order Slappy’s software packages.Discounts are given based on the number of units sold:Number of Units Sold Discount Amount1 – 9 None10 – 19 20%20 – 49 30%50 – 99 40%100 or more 50%Create a form similar to this:The three boxes are labels. Remember to use the Auto Size and Border Styleproperties.The program should read the number of units sold and figure a base cost. Theunits cost $99 each. A discount should then be figured and subtracted from thebase cost. The subtotal, discount amount and total cost should be displayed, ascurrency, in the appropriate labels.Here are some screen shots of the running program:Set the tab order and access keys.Put comments in your program as to what each section is doing.Use constants for the discount rates and base price.arrow_forwardTrace through what values are stored in each variable as the code executes and what values will be displayed. Assume the user enters Nassau, 10 in that order. county input ('Enter the county you live in: ') credits int(input ('Enter the number of credits you are taking: ')) if county 'Nassau' and credits >= 12: == tuition = 2000 elif county == 'Suffolk': tuition 3990 elif credits >= 10: tuition = credits * 160 else: tuition = credits * 30 print (tuition) county credits tuition outputarrow_forward
arrow_back_ios
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