Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You have been asked to help prototype a “movie-rental-system” that manages the r

ID: 3787915 • Letter: Y

Question

You have been asked to help prototype a “movie-rental-system” that manages the rental and returns for 10 movies and 8 customers as a prototype. Assume that each customer can only rent one movie at a time; the rented movie must be returned before another rental can be made. A user of the program will be presented with a menu of four options:

1. Status.

2. Return Movie.

3. Rent Movie.

4. Exit.

If option 1 (Status) is selected, the program will first print the customers names and the movie rented by them (if any). It will then print the catalog movies available for checkout (i.e. only the movies that are not currently rented by another user). If option 2 (Return Movie) is selected, the program will print the list of registered customers and ask the user to select their number . For simplicity, assume that the registered customers are fixed to be the TAs and Instructors of CIE. The user can enter the number (1-8) to select the customer number. Once the customer is selected the movie is returned to the store and will be made available to rent by another customer.

1. Kyle Anderson

2. Kyle Christensen

3. Bradley Evans

4. Mathews Jacob

5. Hans Johnson

6. Elaine Mou

7. Brian Schweer

8. Richard Su

If option 3 (Rent Movie) is selected, the program will ask the user to identify the customer from the list of registered customers. The user can enter the number (1-8) to select. If the customer already has a rental, the system prints out a message that the movie should be returned before the new rental can occur. Otherwise the system will present the list of available movies to rent and ask the user to select one of them. The usr can enter the number (1-12) to select the movie. The system marks the movie to be rented to the customer and removes it from the available list of rentals and returns to the main menu.

1. Passengers

2. La La Land

3. Sing

4. Suicide Squad

5. The Girl on the Train

6. The Magnificient Seven

7. Fifty Shades Darker

8. Moana

9. Arrival

Example run of program (including EC) Welcome to the novie rental system Name: Elaine Mou No novies rented Name: Bradley Evans No novies rented Name: Brian Schweer o noviea rented. Name: Richard Su No novies rented Name: Kyle Anderaon No novies rented Name: Kyle Christensen. No novies rented ame: Mathews Jacob No novies rented Name: Hans Johnson No novies rented Available Movies for rent are Passengers 2 La La Land 3 Assassin s Creed Sing 5 Suicide squad The Girl on the Train 7 The Magnificient Seven 8 Underworld: Blood Wars 9 Fifty Shades Darker 10 Moana 11 Arrival PRESS 1 to list atatus i 2 to return movie 3 to rent 4 to exit Enter Rental customer number from following list 0-8 1 Elaine Mou 2 Bradley Evans 3 Brian Schweer 4 Richard Su 5 Kyle Anderson 6 Kyle Christensen 7 Mathews Jacob 8 Hans Johnson Select from the above movies 0 11 1. Passengers 2 La La Land 3 Assassin's Creed 4 Sing 5 Suicide Squad 6 The Girl on the Train 7 The Magnificient Seven 8 Underworld: Blood Wars 9 Fifty Shades Darker

Explanation / Answer

x = [2 one a pair of 1];
y = [1 a pair of 3];
clin = conv(x,y);
The output has length 4+3-1.

Pad each vectors with zeros to length 4+3-1. get the DFT of each vectors, multiply the DFTs, and acquire the inverse DFT of the merchandise.

xpad = [x zeros(1,6-length(x))];
ypad = [y zeros(1,6-length(y))];
ccirc = ifft(fft(xpad).*fft(ypad));
The circular convolution of the zero-padded vectors, xpad and ypad, is such as the linear convolution of x and y. you keep all the weather of ccirc as a result of the output has length 4+3-1.

Plot the output of linear convolution and therefore the inverse of the DFT product to point out the equivalence.

subplot(2,1,1)
stem(clin,'filled')
ylim([0 11])
title('Linear Convolution of x and y')

subplot(2,1,2)
stem(ccirc,'filled')
ylim([0 11])
title('Circular Convolution of xpad and ypad')


Pad the vectors to length twelve and acquire the circular convolution victimisation the inverse DFT of the merchandise of the DFTs. Retain solely the primary 4+3-1 parts to provide a similar result to linear convolution.

N = length(x)+length(y)-1;
xpad = [x zeros(1,12-length(x))];
ypad = [y zeros(1,12-length(y))];
ccirc = ifft(fft(xpad).*fft(ypad));
ccirc = ccirc(1:N);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote