Question
A movie theater sells 4 different priced tickets: youth, adult, senior, student. Below is a Matlab function called tickets that has 2 vectors as arguments:
A movie theater sells 4 different priced tickets: youth, adult, senior, student. Below is a Matlab function called "tickets" that has 2 vectors as arguments: the first vector has the price of each type of ticket in dollars and the second vector has the # of each type of ticket sold for a group of customers. The function returns the total ticket income and the total number of tickets sold. function [income cnt] = tickets( price, numTickets ) income = price.*numTickets; income = sum(income); cnt = sum(numTickets); end [totalIncome totalCount]= tickets([3 10 6 5], [1 3 1 2]) totalIncome = 49 totalCount = 7
a. The theater has decided to add a special discount. Customers get a percentage off equal to the number of people in their party. Add code to the above function for that modification.
b. The theater is also trying a different special discount. If there are more than 5 customers of a type (youth, adult, senior, student ), one customer of that type gets in free. Modify the code.
Write a Matlab function to solve the problem. Design will be done in lecture or lab D. (4 points) A movie theater sells 4 different priced tickets: youth, adult, senior, student. Below is a Matlab function called "tickets" that has 2 vectors as arguments: the first vector has the price of each type of ticket in dollars and the second vector has the of each type of ticket sold for a group of customers. The function returns the total ticket income and the total number of tickets sold. income price.*num Tickets, income sum income cent- sumonumTickets); end [totalIncome totalCount] tickets (13 10 6 5], [13 1 2]) totalIncome 49 total Count 7Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started