Title: Competency 2.1, 2402--Intermediate Web Programming
Course: Intermediate Web Programming (25436)

ITSE 2402 Intermediate Web
JS Module 2.1 Assignment

Applying the Date and Number Class

- The Date Class
  - You were introduced to the Date class in WindSurfer assignment. Now you will work with the Date Class. You need to define objects of that type. Defining the object is similar to defining an array.
  - Used to work with dates and times.
  - Automatically holds the current date and time as its initial value.
  - Example of instantiating the Date Object (which will default to the current date):
    - var currentDate=new Date();
  - Example of overriding the default value with June 15, 2014 (JavaScript text pages 320 - 321, for commonly used methods):
    - var anotherDate=new Date();
anotherDate.setDate(15);
anotherDate.setMonth(5); // January = 0
anotherDate.setFullYear(2014);
  - Example of comparing currentDate to anotherDate:
    - if (currentDate < anotherDate)
Â Â Â window.alert("The current date is before June 15, 2014");
else
Â Â Â window.alert("The current date is either June 15, 2014 or after June 15, 2014");
  - Example of changing the date to yesterday:
    - anotherDate.setDate(anotherDate.getDate()-1);
    - If subtracting one day from the date causes the date to be in the preceding month and/or year, the changes to the month and year portions of the date are handled automatically by the date class itself.
- Number Class
  - Used to define, manipulate, and modify numeric values
  - Defines methods such as toFixed(), toPrecision(), toString(), valueOf(), toExponential(), Number(), toLocaleString()
  - Defines special values such as MAX_VALUE, MIN_VALUE, NaN, NEGATIVE_INFINITY, POSITIVE_INFINITY
- You are going to start a site that I hope can be used in your portfolio. You will begin it now, but add to it later. The idea is that this is an international ATM so that you can check your money in more than one currency. It is fun, and you will work with the Date, Number, and string classes.
  - Open a blank page. Write the code (no html) that calculates the current date and tomorrow's date.
  - Save as tomorrow.js
  - Open your templateHTML5.htm page.
  - Save your page as currency.htm.
  - Your currency page should:
    - Add the external JavaScript tomorrow.js to your currency page.
    - Display the current date and tomorrow's date.
    - Contain a form with:
text that asks "What is the amount of U. S. dollars you want to convert?"
a textbox to allow the user to enter an amount.
text that asks "To which currency would you like to convert?"
Radio buttons for 3 different currencies. For example:
British Pound
EUR
Peso
A button with the value Convert
  - Link to a css page that you are to create.
  - Save your document in your module2 folder.
- Create a css page to create an attractive, readable page.
- Create conversion.htm
  - Add the external JavaScript tomorrow.js to your currency page.
  - Display the current date and tomorrow's date.
  - Using the country choice sent by the user, convert the amount entered to the foreign rate.
  - To determine which conversion you are to make, (remember you gave 3 choices) use the switch statement.
  - Using the values of the USD entered and the conversion currency, convert the value.
    - Currency Converter for 164 Currencies
    - To use this site
      - Enter a 1 in the text box labeled Convert amount
      - Enter USD in the first text box labeled Currency Code
      - Enter the appropriate abbreviation in the second text box labeled Currency Code
      - Click the button Convert Now
      - You will be given the equivalent amount of 1 US dollar.
      - Use that amount to multiply times the amount entered by the user to get the conversion amount.
  - Display the results. The gif example below shows how a page might look.
The first line says: "Thank you for using Express Conversion"
There is a blank line.
The second line says: 100 U S Dollars = 77.40178 Euro
Then, show the validation icons for both XHTML and CSS taken from the template.
The conversion rate you use may have changed, and you may make your output as you wish as long as it can be read. Here is the gif just described.
- Be sure that you add links to your validation.js script on both your currency and conversion pages.

Update your index page:

- Add links on your index page to the pages in your assignment folder that are to be graded:
  - conversion.htm
  - currency.htm

Uploading:

- Upload your revised index.htm page to the public_html folder.
- Upload your module2 folder with the files:
  - currency.htm
  - conversion.htm
  - Any CSS pages you use unless you link to a CSS folder, then add your css to that folder.

Testing uploaded pages

- Once uploaded, go to your site for this course.
- Validate your index page and all pages in this assignment (your css page will validate through the html pages that refer to your css page)
- Make any corrections for any page that does not validate or display correctly.
- Email your instructor for grading.