Question

In: Computer Science

PHP You will be using the object oriented features of PHP to design a music album...

PHP

You will be using the object oriented features of PHP to design a music album processing page.

First you will build a form page called addAlbum.php. This form will contain text fields for album title, artist, publisher (Sony, BMI, etc.) and genre. Add two more fields of your choice. You will post this form to the file process.php.

If all the fields have values, we will create a new Album object and print the details of the object. You will need to create an Album class that has private instance variables for all the fields just described. Your constructor should simply echo to the screen "Album created." If the user missed some of the form, give them a link to go back and fix.

Generate standard getters/setters

You will need to create __get and __set functions (magic functions) to allow us to set the properties of the instance variables from outside the class. You will also create a function (or method) called __toString() in the class. Calling this will return a formatted string of all the details for the album. Store the class in album.class.php.

Include a hyperlink back to add another album.

Sample output could look like this:

Album Created
Album Title: Blaze of Glory
Artist: Jon Bon Jovi
Publisher: ASCAP
Genre: Rock
Custom Field: stuff
Another Custom Field: stuff

Add another album! (This is an hyperlink to add another album)

Requirements

i. Comments on all pages, proper page names (as requested), aligned code, overall effort
ii. addAlbum.php page is complete - doctype, complete html structure and some instructions that give the user some indication of what they are to do
iii. album.class.php - contains code to define album class - as well as documentation/comments to outline how to use - see requirements for details (private vars, constructor, magic methods(__get(),__set() and __toString functions)
iv. Some type of validation used so that user knows about errors
v. Styles for all pages: Use an external stylesheet for all styles. All page content should be in a div with an id set to 'container', 650px wide and the content centered.

vi.The container div should also be centered on the screen (horizontally). The constructor text should be echoed using an <h3> tag. Please bold all labels as displayed above.
vii. Use the Button class to print the submit button on the form page addAlbum.php.

Solutions

Expert Solution

Add Album.php

<!DOCTYPE html>
<html>
<body>

<h1>Add Album</h1>

<form action="/process.php" method="get" target="_blank">
<label> album title:</label>
<input type="text" name="title"></input><br/><br/>
<label> artist:</label>
<input type="text" name="artist"></input><br/><br/>
<label> publisher (Sony, BMI, etc.):</label>
<input type="text" name="publisher"></input><br/><br/>
<label> genre:</label>
<input type="text" name="genre"></input><br/><br/>
<input type="button" name="submit" value="submit"></input>
  
  
</form>

<p>Click on the submit button, and the input will be sent to a page called "process.php".</p>

</body>
</html>

Process.php

<!DOCTYPE html>

<h1>processs.php</h1>
<?php
$title= $_POST['title'];
$artist= $_POST['artist'];
$publisher=$_POST['publisher'];
$genre=$_POST['genre'];
  
echo "Title:".$title."\nArtist:".$artist."\nPublisher:".$publisher."\nGenre:".$genre;
?>

AlbumClass.php

<!DOCTYPE html>
<html>
<body>

<h1>Album Class.php</h1>
<?php
class Album{
   var $title;
var $artist;
var $publisher;
var $genre;
function __construct($title,$artist,$publisher,$genre) {
$this->title = $title;
$this->artist = $artist;
$this->publisher = $publisher;
$this->genre = $genre;
echo "Album created.";


   }
//<p><a href="addAlbum.php">Visit: you want any changes!</a></p>

   public function setTitle($title){
$this->title = $title;
}
public function getTitle(){
return $this->title;
}
public function setArtist($artist){
$this->artist = $artist;
}
public function getArtist(){
return $this->artist;
}
public function setPublisher($publisher){
$this->publisher = $publisher;
}
public function getPublisher(){
return $this->publisher;
}
public function setGenre($genre){
$this->genre = $genre;
}
public function getGenre(){
return $this->genre;
}
public function __toString() {
return "\nAlbum Title:".$title."\nArtist:".$artist." \nPublisher:".$publisher."\nGenre:".$genre;
  
}
}

?>

<p><a href="/AddAlbum.php">Add Another album!</a></p>

</body>
</html>

Output:

I hope this will help if not please comment below i will help you!!

Please do not forget to Upvote the answer!

Happy Learning!!


Related Solutions

Q: How do you design object oriented design models using: a. Phillip Kruchten (4+1) View b....
Q: How do you design object oriented design models using: a. Phillip Kruchten (4+1) View b. Model Driven Development (MDD) c. Remote Procedure Call (RPC) Assume scenarios or examples to elaborate each of the above.
Design a class that holds the following data regarding a music album: artist, title, number of...
Design a class that holds the following data regarding a music album: artist, title, number of tracks, and year released. Write appropriate accessor and mutator methods. Also, write a program that creates three instances of the class. Each instance will hold information about a different music album. Make sure to display all of the information for all three albums to the screen in an organized manner. **Using python**
This week, you will create and implement an object-oriented programming design for your project. You will...
This week, you will create and implement an object-oriented programming design for your project. You will learn to identify and describe the classes, their attributes and operations, as well as the relations between the classes. Create class diagrams using Visual Studio. Review the How to: Add class diagrams to projects (Links to an external site.) page from Microsoft’s website; it will tell you how to install it. Submit a screen shot from Visual Studio with your explanation into a Word...
Describe how you would develop object-oriented features of Java for the Quiz program developed in the...
Describe how you would develop object-oriented features of Java for the Quiz program developed in the Programming Assignments. In particular, describe how the program could use each of the following: class variables, instance variables, inheritance, polymorphism, abstract classes, "this", "super", interfaces, and event listeners.
Describe how you would develop object-oriented features of Java for the Quiz program developed in the...
Describe how you would develop object-oriented features of Java for the Quiz program developed in the Programming Assignments. In particular, describe how the program could use each of the following: class variables, instance variables, inheritance, polymorphism, abstract classes, "this", "super", interfaces, and event listeners. Your Discussion should be at least 250 words in length, but not more than 750 words. Once you’ve completed your initial post, be sure to respond to the posts of at least 3 of your classmates.
Explain Basic Characteristics of Object Oriented System Analysis & Design.
Explain Basic Characteristics of Object Oriented System Analysis & Design.
Cash Money Records is considering publishing a new music album. The fixed cost of an album...
Cash Money Records is considering publishing a new music album. The fixed cost of an album preparation, studio time, and guest appearances is estimated to be $850,000. Variable costs are estimated to be $2 per album. The music label plans to sell access to the album for $10 each at various online marketplaces. (Report all Solutions on Excel documentation) a. Build a spreadsheet model to calculate the profit/loss for a given demand. What profit can be anticipated with a demand...
Problem Write a movie management system using object-oriented design principles. The program will read from the...
Problem Write a movie management system using object-oriented design principles. The program will read from the supplied data file into a single array list. The data file (movies.txt) contains information about the movies. Each movie record has the following attributes: - Duration (in minutes) - Title - Year of release Each record in the movies.txt file is formatted as follows: - Duration,Title,Year - e.g.: 91,Gravity,2013 Specifically, you have to create an interactive menu driven application that gives the user the...
BMG Music ran a direct TV campaign on a special anniversary album. Each album sold for...
BMG Music ran a direct TV campaign on a special anniversary album. Each album sold for $49.99 at retail. The company charged each customer with $7.99 for shipping and handling. The cost of producing the album was 45% of the retail price. The Direct Marketing cost for the promotion were as follows: TV ad design costs are $85,000; to place the spots on air cost $750,000. It used a telephone call center to handle inbound telemarketing calls; process each order...
In this assignment, you will practice solving a problem using object-oriented programming and specifically, you will...
In this assignment, you will practice solving a problem using object-oriented programming and specifically, you will use the concept of object aggregation (i.e., has-a relationship between objects). You will implement a Java application, called MovieApplication that could be used in the movie industry. You are asked to implement three classes: Movie, Distributor, and MovieDriver. Each of these classes is described below. The Movie class represents a movie and has the following attributes: name (of type String), directorsName (of type String),...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT