This is an individual assignment.
Set up and preparation
Download a zipped copy of the
hw02 starting folder onto your Desktop and open it by double-clicking on it.
This folder contains a file
bookstore.html, which you will use for this Part
of the assignment.
Start by opening the file in a word editor (like Textwrangler) and edit the top of the file comments to include your name and information.
bookstore.html, within the
start and end
First read the whole description and look at the images below. Your code should do the following:
- Prompt the user for the number of books to order. Set the default value to 100.
- Prompt the user for the number of magazines to order. Set the default value to 20.
- If the number of books ordered is less than 25, charge $50 per book; otherwise, charge $40 per book.
- If the number of magazines ordered is less than 25, charge $15 per magazine; otherwise, charge $10 per magazine.
- Charge a shipping fee of $25 if the total order is under $500. Shipping is free if the total order cost $500 or more.
- Output the information:
- the number of books ordered
- the price per book
- the number of magazines ordered
- the price per magazine
- the total number of items
- the total cost (without shipping)
- the total cost (including shipping)
- Display that information in the console and on the page. bookstore.html contains a skeleton for displaying this information.
- Finally, there are two questions about testing your code in the comments. Make sure to answer these questions in the comments.
Here is the what your page should look like when prompting for an input and then displaying the results:
Submit your work by uploading
public_html/cs115-assignments folder, in your personal directory.
Once you've uploaded your work, make sure you check the page on the browser using the URL :
When you visit the page, because this is in a protected directory, you will be prompted for a username and password. Use your own login name and password for your account on the CS server.
There is no need to validate your code, but you can do so if you wish to.
Assignments are due at 11:59PM on the due date (check the schedule). Remember that this policy means that you should not modify work after the due time has passed.
These are the criteria we use to grade the homework:
- Homework was submitted on the server by the due date.
- Folders and files have the required names and are uploaded to the proper location.
- Your files have comments at the top and as necessary interspersed in the code.
- Your code follows our recommended coding style.
- Your have answered the questions in the comment section.
- The bookstore page performs and displays the calculations correctly.