Goal: Continue familiarizing yourselves with the MVC framework, paying special attention to the difference between GET and POST requests, testing controller logic, and creating multi-controller applications.
Work through the homework lessons and complete the to do list application.
In section one, we built a car dealership application with our pairs. Today, either restart or build upon your existing car dealership to create an MVC web application that allows users to add new cars through a nicely-formatted web interface.
Make sure the
Car class includes a constructor as well as getters, setters and private properties.
Think carefully about how to use static properties to post new cars to site. (In the To Do List example, we added
Items to a list using the keyword
this. For this exercise, we are dealing with
Cars instead. How should we declare
_instances in this case? What kind of data type should we use?
Following the guidelines below, create a website for a fictional shipping company that helps users calculate shipping estimates:
Parcel class. It should contain a constructor, and getters and setters for each property. You should be able to create a new parcel and specify the dimensions and weight in the arguments.
Create a website where the user can submit a form with the dimensions and weight of a
Parcel, and you can use the data in the form to instantiate a
Parcel object and display its dimensions and weight.
When you call a method called
Volume() on a
Parcel instance, it should return the product of the sides.
When you call a
CostToShip() method on your parcel, return a cost based on a formula you make up.
Display the cost to ship and the volume of a
Parcel with its dimensions in your site.
Bonus: Add validation and make sure the
Parcel object is not created if any of the form fields are blank. Display an error message instead. Also make sure your user can only enter numbers into the form.
Create a section of a job posting board where a user can create one instance of a
JobOpening class by submitting a form. It should include properties for a title, description, and contact info for the person posting the job.
If you're feeling fancy, make the contact info into an object with its own class declaration. Hint: A
Contact object would include properties like a
phoneNumber, and you would want to store it inside the
Lesson 27 of 38
Last updated more than 3 months ago.