Question
Arrays and Sorting Excercises - PHP 1. Write a program that uses a function to add two numbers together. 2. Write a program that prompts
Arrays and Sorting Excercises - PHP
1. Write a program that uses a function to add two numbers together.
2. Write a program that prompts the user for a number, using a function return if the valude is odd or even, your function must return a boolean value (true or false).
3. Write a program that calculates the area of a cube. Use a function to perform the calculation.
4. Write a program that pronts the user for the address label, store it in an associative array. Your function when printing the label must accept only one array and print the information out in format:
5. White a program that prompts the user for an unliminted set of numbers, store the numbers in an array and then have the program do the following: Add all the numbers together Determinate the average of all the numbers Determine the hightest number Determine the lowest number> You must store the results for all of the above calculations in a single array using one funciton. You must print them out using another function that accepts the array from the calculations function.
6. Write a program that contains the following data in an array. Sort the Array by population in reverse order and print out the result. You must use the usort() function.
7. Given the following data, write a program that holds the information in an array. Write a program that calculates the total amount of sales per category for the year 2019 in an array. Your program logic should allow for additional items and categories without modifying the logic.
[First Name] [Last Name] [Street Address] [City], [Province] [Postal Code] City Population Vancouver 631,486 Surrey 517,887 Burnaby 232.755 Richmond 198,309 Abotsford 141,397 Victoria 85,792 Price $19.99 Item Category Year Wool Scarf Clothing 2018 Wool Socks Clothing 2019 Pocket Knife Accessories 2018 Black Wristwatch Accessories 2019 $14.99 $49.99 $19.99 Pocket Light Accessories 2019 $35.99 Print the output per categoryStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started