COMS 210 MSU Mankato Create a Computer Program Computer Coding Task
Question Description
The assignment is
We are now in Day08 of our Internet Programming course. Today, we will do some coding and put our work here in this discussion forum. Make sure your Atom or VSC environment is setup to act as a PHP server and you can test your output to your computer’s web browser. See the instructions here in the Day07 video (the beginning).
There are several exercises that follow and you should place your code in a new discussion titled “PHP Code Exercise #2 – Perry”, using your name to indicate to others that this is your discussion answers. Some will be easy to do, while others will require a bit more thought. Use the monospaced font in the Moodle editor and space or indent the PHP code appropriately.
You will receive 10 points for your discussion post with your PHP code and 2 points for commenting constructively on 2 other of your fellow student’s code. Feel free to comment on more than 2 other discussions as it benefits everyone.
===========================================
PHP Beginnings Ex. #2: Create and Use Variables
For your second PHP exercise, echo the following statement to the browser:
Twinkle, Twinkle little star.
Next, create two variables, one for the word Twinkle and one for the word star. Echo the statement to the browser, this time substituting the variables for the relevant words. Change the value of each variable to whatever you like and echo the statement a third time. Remember to include code to show your statements on different lines.
===========================================
PHP Beginnings Ex. #4: Arithmetic-Assignment Operators and Variables
Arithmetic-assignment operators perform an arithmetic operation on the variable at the same time as assigning a new value. For this PHP exercise, write a script to reproduce the output below. Manipulate only one variable using no simple arithmetic operators to produce the values given in the statements.
Hint: In the script each statement ends with “Value is now $variable.”
Value is now 8.
Add 2. Value is now 10.
Subtract 4. Value is now 6.
Multiply by 5. Value is now 30.
Divide by 3. Value is now 10.
Increment value by one. Value is now 11.
Decrement value by one. Value is now 10.
============================================
PHP Beginnings Ex. #7: Variable Data Types
PHP allows several different types of variables. For this PHP exercise, you will create one variable and assign it different values, then test its type for each value.
Write a script using one variable $whatsit to print the following to the browser. Your echo statements may include no words except Value is. In other words, use the function that will output the variable type to get the requested text. Use simple HTML to print each statement on its own line and add a relevant title to your page. Include line breaks in your code to produce clean, readable HTML.
Value is string.
Value is double.
Value is boolean.
Value is integer.
Value is NULL.
=================================================
PHP Control Structures Ex. #1: If-Else Statement
In this PHP exercise, you will use a conditional statement to determine what gets printed to the browser. Write a script that gets the current month and prints one of the following responses, depending on whether it’s August or not:
It’s August, so it’s really hot.
Not August, so at least not in the peak of the heat.
Hint: the function to get the current month is ‘date(‘F’, time())’ for the month’s full name.
=================================================
PHP Control Structures Ex. #2: Simple Loops
In this PHP exercise, you will put all the loops through their paces. Write a script using first a while loop, then a do while loop, then two for loops. The script will output the following to the browser:
abc abc abc abc abc abc abc abc abc
xyz xyz xyz xyz xyz xyz xyz xyz xyz
1 2 3 4 5 6 7 8 9
1. Item A
2. Item B
3. Item C
4. Item D
5. Item E
6. Item F
Create the ‘abc’ row with a while loop, the ‘xyz’ row with a do while loop, and the last two sections with for loops. Remember to include HTML and source code line breaks in your output. No arrays allowed in this solution.
"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."