Question

In: Computer Science

This assignment is about creating a online movie rental store. Use arrays and loops for this...

This assignment is about creating a online movie rental store. Use arrays and loops for this assignment.

1) Create a web page containing a list of movie names available for rent (at least 10 movies), so that each time you visit the home page, you see a different order of movies in the list. The movie names are required, all other information is optional.)

2) The rental price for each movie ranges between $1.99 to $7.99.

            • Create an associative array with a code for the movie as the key (e.g., movie1, movie2, etc.) and the associated rental price as the value. Display the array using the print_r() function.        

            • Sort the array according to the rental price in ascending order. Display the array again using the print_r() function.    

            • Calculate and display the average rental price for a movie.

            • Find and display the two highest and two lowest rental prices.

Display these results on the same page.

Again, display appropriate warning/error messages as needed.

Solutions

Expert Solution

PHP program for given assignement is as bellow, if you have any query regarding program please do comment I will solve all your queries thank you.

<!DOCTYPE html>
<html>
<head>
<!-- Required meta tags-->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
   <meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-store,no-cache">
<!-- Your app title -->
<title>Movies</title>
</head>
<body>
<div class="movies">
<h1>Movies</h1>
<ul>
<?php
//declared associative array movies
$movies= array(
"Avatar"=>"2","Inception"=>"2.5","Avengers"=>"4","Spiderman"=>"3.66","Deadpool"=>"5.44","Terminator"=>"6","Star War"=>"4","The Prestige"=>"3","Shadow"=>"4.65","Apollo"=>"2.3");
$movieNames=array_keys($movies);

//shuffling array to display list of movies in random sequence each time

shuffle($movieNames);
foreach($movieNames as $m)
{
echo "<li>".$m."</li>";
}

?>
</ul>
<?php
echo "<b>Array without sorting</b> <p>";
print_r($movies);
echo "<p/>";

//sorting array in ascending order
arsort($movies);
echo "<b> Array After Sorting </b><p>";
print_r($movies);
echo "<p/>";
$average = array_sum($movies)/count($movies);
echo "<b> Average Rental Of Movies Is</b><p>:$".$average."<p/>";
$l = array_slice($movies,0,2,true);
$m= array_slice($movies,count($movies)-2,count($movies));
echo "<br/><b>Highest Rental Prices:</b><p>";
$i=1;
foreach ($m as $key => $value) {
# code...
echo $i.")$".$value."<br/>";
$i++;
}
echo "<p/><b>Lowest Rental Prices:</b><p>";
$i=1;
foreach ($l as $key => $value) {
# code...
echo $i.")$".$value."<br/>";;
$i++;
}
echo "</p>";
?>
</div>


</body>
</html>


Related Solutions

Create a website for an online movie rental store, using HTML (and any other client technologies)...
Create a website for an online movie rental store, using HTML (and any other client technologies) and PHP. The website should include: - A front/home page containing a list of movies available for rent (list at least 10 movies). o Each movie should have a listed rental price. o Additional information provided: § name of actors in the movie (list at least 2) - The home page should link to a form for renting a movie o Selecting and submitting...
Write a program in c++ using only while and for loops . Use of arrays and...
Write a program in c++ using only while and for loops . Use of arrays and functions is not allowed. Given the first value, generate the next ten terms of the sequence like 1, 2, 4, 8, 16, 22, 26, 38, 62, 74, 102, 104, … Explaination with code is required.
Assignment - Store Design and code a HTML/CSS/JS based web application for your online store. Assignment...
Assignment - Store Design and code a HTML/CSS/JS based web application for your online store. Assignment Specification · Minimum of SIX web pages are required for this assignment: § One Landing/Container Page ( a page with logo) § One Home Page § Three or more Product Line Pages (pages with product and it information ) § One Order Page (for customer to order a product after view the profuct on the product page) · Build internal CSS style sheets in...
Assignment 7 Preparation This assignment will focus on the use of loops, random numbers, named constants,...
Assignment 7 Preparation This assignment will focus on the use of loops, random numbers, named constants, and arrays. Assignment 7 Assignment 7 Submission Follow the directions below to submit Assignment 7: Create a Java program. The class name for the program should be 'RandomDistributionCheck'. In the main method you should perform the following: You should generate 10,000,000 random numbers between 0 - 19. You should use an array to hold the number of times each random number is generated. When...
Assignment 7 Preparation This assignment will focus on the use of loops, random numbers, named constants,...
Assignment 7 Preparation This assignment will focus on the use of loops, random numbers, named constants, and arrays. Assignment 7 Assignment 7 Submission Follow the directions below to submit Assignment 7: Create a Java program. The class name for the program should be 'RandomDistributionCheck'. In the main method you should perform the following: You should generate 10,000,000 random numbers between 0 - 19. You should use an array to hold the number of times each random number is generated. When...
What impact did the advent of online video rentals and streaming have on the in-store movie...
What impact did the advent of online video rentals and streaming have on the in-store movie industry? Use the demand and supply diagram to illustrate your answer. Pay attention to how the equilibrium quantity and price adjust. Make state all your assumptions. (What impact did the advent of online video rentals and streaming have on the in-store movie industry? Use the demand and supply diagram to illustrate your answer. Pay attention to how the equilibrium quantity and price adjust. Make...
Please write about the documentary movie of (Inside Job) Movie Assignment as following questions below ....
Please write about the documentary movie of (Inside Job) Movie Assignment as following questions below . Don't write about Wall Street . This is the 2nd question posting 1. Discuss the serious ethical concerns for business in the "Inside Job movie". 1. How business was portrayed in the film of Inside Job. What you should find is that business is generally portrayed in negative terms. For example, most business people in these films are motivated by greed. There are exceptions....
This assignment will acquaint you with the use of while loops and boolean expressions. You will...
This assignment will acquaint you with the use of while loops and boolean expressions. You will create a program that acts as a score keeper of a racquet ball game between two players. The program will continually ask the user who the winner of every point is as the game is played. It will maintain the scores and declare the match is over, using these rules: (1) A game is over when a. one of the players wins 7 points...
Management Information System This assignment is about creating a blog and a research about working for...
Management Information System This assignment is about creating a blog and a research about working for The Office of Career Services at a school. Answer the following questions based on your team project The Office of Career Services. Pretty much we are making up this job so you can include any vendors and any inter-enterprise. (you can just make-up your own idea or use imagination) . What are CRM, ERP and EAI? Who are the major ERP vendors? Does your...
Program Assignment 1 C++ please Instructions This assignment will require the use of three arrays, which...
Program Assignment 1 C++ please Instructions This assignment will require the use of three arrays, which will be used in parallel. Create a program that keeps track of the sales of BBQ sauces for a company. The company makes several different types of sauces, Original, Sticky Sweet, Spicy, Sweet Heat, Hickory Bourbon and Smokey Mesquite. One array will contain the names of the different BBQ sauces. This array will be initialized from a text file with the 6 different names....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT