Professional Documents
Culture Documents
Solutions
Homework 2
Assignment
Problem 1
Problem 5
Problem 2 According to the U.S. Census Bureau, the 10 largest American cities (by population) in 2000 were as follows:
Define an array (or arrays) that holds this information about locations and population. Print a table of locations
and population information that includes the total population in all 10 cities.
Solution
<?php
Output
City Population
New York, NY 8,008,278
Los Angeles, CA 3,694,820
Chicago, IL 2,896,016
Houston, TX 1,953,631
Philadelphia, PA 1,517,550
Phoenix, AZ 1,321,045
San Diego, CA 1,223,400
Dallas, TX 1,188,580
San Antonio, TX 1,144,646
Detroit, MI 951,270
Total 23,899,236