Task 1 is an individual assignment,
Task2 is a paired-programming one.
Part 1: On Number Systems
Please answer the questions in
Pair programming part
as you have experienced it in lab, is an agile software development technique in
which two programmers (or students) work together sharing one computer.
One student is the driver, who controls the keyboard and mouse.
The other is the navigator, who observes, asks questions, suggests
solutions, and thinks about slightly longer-term strategies. The two programmers
switch roles about every 20 minutes.
Working in pairs should make you much better at programming than would working alone. Research shows that the resulting work of pair programming nearly always outshines that of the solitary programmer, with pairs producing better code in less time.
To learn the do’s and don’ts of pair programming and to see pairs in action, view this entertaining video about pair programming from North Carolina State University: An Introduction to Pair Programming for Students.
(The above information about pair programming is adapted from NCWIT)
Use this team-forming shared document to form and declare teams.
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 names and the rest of the information.
bookstore.html itself, using 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 this 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. Add your answers on the page as 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 directory.
Notice that although this is a pair-programming task, both partners
need to upload the work to their individual accounts.
Once you've uploaded your work, make sure you check the page on the browser using this URL :
(Of course substitute "yourName" with your own account name.)
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.
It is not required 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.
- Files are commented at the top, and as necessary interspersed in the code.
- Your code follows our recommended coding style.
- Questions are answered as described above.
- Correctness of the calculations and the display.