Assignment 2

This assignment has you creating two short web pages. You may find that you need to review certain parts of the lectures, but you have been given all of the tools you need in order to fulfill all of the requirements here. For example, in some cases, I ask you to look up certain things on your own, but again, we have practiced going to a reference and figuring out how to do this.

First page: Create an HTML page called favorite_artists.htm.

Search the web for 4-5 of your favorite bands/singers teams that have websites. Create an unordered list of them based on your favorites. Hyperlink each name to singers website. If you prefer, feel free to choose another topic such as favorite sports teams / knitting techniques / computer science profs, etc.

  • Pretend that one of your favorite bands has the crazy name: The < hr> Band (could happen!). Unfortunately, if you try to type that name in your text editor, the browser will interpret the hr as a tag and insert a line. So you will want to insert the < and > characters using entities. (The name does not have to be in bold).
  • Add an additional (fictional) band that has the name (Greek letters, delta, sigma, and omega). Write out this name (not in bold) using character entities as before, and link them to the Wikipedia page http://en.wikipedia.org/wiki/Greek_alphabet.

Second page: Create another HTML page called restaurant.htm.

Create a list of a few different foods in the following categories: Sandwiches, Drinks, Desserts. Create these categories using an h2 tag.

  • Under each of these three items, have another list (i.e. a nested list) that lists at least three items for each. For example, under sandwiches you might have: Hamburger, Hot Dog, Panini. The outer list should be ordered. The inner list should be unordered.
  • For one of the categories, have each item in the inner list hyperlinked to an image. So if under Drinks you have Mimosa as one option, when the user clicks on Mimosa, your page should display an image of a mimosa. Have the image display in a new tab. Note: To hyperlink to an image, you only need to type the filename of the image as the value to the href attribute. You should not write http or anything else. Simply type the name of the file.

Assignment 4

Remember to be sure and practice the concepts and materials BEFORE working on the assignment. You will learn and retain the material much more effectively.

1. Create a page in which you have 3 buttons. The first button says, Print Name in < h1>, the second says: Print Name in < h2>, and the third says Print Name in < h3> (you dont need to include the quotes). Depending on which button the user clicks, use a document.write statement to output your name (or any string you like) in the chosen heading (< h1> or < h2> or < h3> as appropriate). Also. As we practiced in class, you will want each button to connect to its own function.

2. Sometimes in programming, we have to look at code that is unfamiliar and figure out how to work with it. This problem asks you to do that in a fairly basic way. Here is a line of code that determines the square root of 10: Math.sqrt(10) Create a page that has three buttons, one says: Square Root of 10 that will display an alert box showing the squre root of 10. There Math class also gives you a power function that returns an exponent so that, for example, Math.pow(2,3) returns 23 (i.e. 8). Have a button that says 2 Cubed that will output that result. For the third button, go to W3Schools and look up the Math object in the Javascript section. Choose any function you like as your 3rd function to demonstrate. Use alert boxes to demonstrate the output of these functions.

3. Create a form to add people to your pizza companys mailing list. (The pizza company you created previously). Have fields for first name, last name, email address, and phone number. Have a radio button with options for yes and no in which you ask the user if they would like to be added to your companys mailing list for periodic specials, etc. When the user submits the form, output an alert box thanking them for submitting their information. This page should have Div sections for the header and main content

Assignment 5

As always, I can not emphasize enough the importance of reviewing the material and practicing the concepts BEFORE attempting the homework. If you do so, you will see that the assignment is not all that difficult. If, however, you try to begin the assignment with no or very little practice and review, you may get through it, but it will take you longer, you will make more mistakes, and you will not understand the material as well. Just my $0.02.

1. For this question, you will write a currency converter. You will have a text field where you ask the user to enter a quantity in U.S. Dollars. Then have 3 buttons, one says: Convert to Euros, another that says Convert to British Pounds and a third that says Convert to Mexican Pesos. When the user clicks the button, a function should be invoked that outputs the resulting conversion using a document.write statement.

a. Use the following conversions: 1 USD = 0.76 Euros, 0.62 British pounds, 13.23 Mexican Pesos

b. Have some kind of heading section that says: Currency Converter or something similar. Have some kind of image there as well such as a picture of currency symbols, etc.

c. Have two div sections one for the header section, and another for the main section.

d. Your document.write statement should be in a complete sentence like this: For $150 US Dollars, you will get 114 Euros.

e. Be sure to create a variable to store the US currency and have a second variable to store the foreign currency. Feel free to create other variables as needed, but you should not need to for this assignment.

2. Use your pizza ordering page. From assignment #4. Modify it to ask the user for their full name, street address, and phone number. Also have a select box for pizza size where the options are personal ($6), medium ($9), large ($12). Store all of these into variables. When the user submits the form, output a confirmation using innerHTML. The confirmation should thank the user and confirm all the text field info that they entered (Not pizza size or toppings). It will be a fairly long output statement (lots of plus signs!), so you will probably want to turn word-wrap on within your text editor. So your output might look something like this: Thank you Bob Smith! We have your address as 123 Memory Lane, your phone number is 847-333-4444.

a. Again, have at least two div sections, one for the header and second div section for your main content such as the form.

Assignment 6

Page #1

Suppose you are responsible for assigning percentage grades for a course that has 4 homework assignments worth 50 points each, a midterm out of 100 and a final out of 100. The percentage score for the course is calculated as:

  • Total homework score (a number out of 200) making up 50% of the course percentage grade.
  • The midterm makes up 20% of the course percentage grade.
  • The final make up 30% of the course percentage grade.

Create a form in which you ask the user to enter their total homework score, their score on the midterm, and their score on the final. When they submit the form, indicate to them their percentage score using innerHTML.

As an example, if they scores 180/200 on their homework, 90/100 on the midterm and 95/100 on the final, you would calculate their percentage grade as: (180/200*50) + (90/100*20) + (95/100*30) which comes out to 91.5.

Page #2

Modify your pizza ordering form from assignment #5 for this problem.

On your pizza ordering page ask the user for the size of pizza they would like. You may keep the same options as you had for assignment #5: personal = $6, medium = $9, large = $12. However, include an additional option for extra large: $16. Also have a select box for number of drinks with options for 0, 1, 2, 3, 4. Each drink costs $1. Finally have a select box for number of desserts, also with options between 0 and 4. Each dessert costs $3. When the user submits their order, output the total cost of their order as well as all their other information. So if they ordered a large pizza ($12) plus two drinks (2 * $1 = $2.00) plus two desserts (2*$2 = $6.00), you would output their total cost as being $20. In the output statement, also indicate the time/date of their order. You may use the Date() function to do so. You may output using innerHTML.

Assignment 7

Use the requirements from the pizza part of Assignment 6 and do the following using CSS and an internal style sheet:

1. Your Javascript function should be in an external file (dont forget to move it up to studentweb too)

2. Put a red border of 300px in width around the form

3. There should be three Div sections: header, main_body, and footer.

4. Center the name of your company in the header Div

5. The text used in the header div should be in blue

6. Set a background color for the body

7. Set a different background color for the footer Div.

8. Font for footer Div should be Arial and in italics.

9. Include checkboxes for at least three toppings each costing $0.50

10. Output everything from the previous assignment and have the order total now including toppings using innerHTML

Assignment 8

Use all of the requirements from the pizza part of Assignment 6.

a. Use an External Style Sheet

Choose a background color for the < body>

Center the information in the header

Put a red border around the form (just the form)

Put a border around the footer

b. As before, use an External Javascript file.

2. Use Text Boxes for Name, Address, Phone and email.

3. Use a select box for pizza size (small $6, medium $9, large $12, extra-large $16).

4. Use a select box for number of drinks and each drink costs $1.00.

5. Use a select box for number of desserts and each desert costs $3.00.

6. Add at least 3 checkboxes for pizza toppings where each topping costs $.50.

7. Use a text area for special instructions.

8. Use innerHTML for the order confirmation.

9. Confirm all items in the order including all customer information (including special requests) except email.

10. Confirm the total cost of the order.

11. Include code to do the following: if their order is $25 or more, tell them they just earned a free medium pizza with their next order and the code for it is Q1358 and it is to be printed out along with the other data.

12. Use radio buttons to ask if they want to be added to the mailing list.

13. Confirm their email only if they checked to be added to the mailing list.

14. Include the date and time of the order.

15. The date and time should be in short form: e.g. 3/5/2015 at 3:46:05 PM

16. Change the style on the submit button with an inline style so that the background of the submit button is blue and the text is yellow.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.