Recent Question/Assignment
Week 4 Hands-On Exercises - PHP Classes & Objects
Before you do the exercises
If you haven’t already done so, you should create a folder in your personal drive for all the exercises. This set of exercises requires a functioning webserver to interpret the PHP code.
1. Create a PHP program with a class Customer with the following properties: customer_id,
customer_name, customer_address, customer_state, customer_postcode, and customer_phone. The program includes get and set methods for each property. Validate the proper type and size of data passed into each property. The program also includes the ability for each property to use the constructor to set values. Create an instance of the class passing properties through the constructor. Change two of the properties using set methods. Display the properties using get methods.
Run the program, check the results, and take screenshots.
2. Create a PHP program to keep track of inventory within a grocery store. Each item (class) includes an item_number, description, isle, amount, and price. Each field must be verified for proper information before the entries are accepted. Item numbers range from 00000 to 99999. The store has 16 isles (00–15). No price in the store is greater than $1000. Amount is not negative and not more than 500. All entries are coded via a constructor or set methods. Create 5 instances/objects of the class. After all entries have correctly been accepted, the program will generate a report of the entries (using get methods).
Run the program, check the results, and take screenshots.
To Submit:
Create a folder and name it “Week4handson” - no spaces in the name. Put on all of the program files that you have created for all exercises and a file containing screenshots of running the programs into this folder. Compress the folder, using a zip or rar utility, and then submit this zipped folder to the correct submission link on Moodle.