Assignment2

Assignment2 - ASSIGNMENT 2 Conditionals and Loops...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ASSIGNMENT 2 Conditionals and Loops COMP-202A, Fall 2010, All Sections Due: Wednesday, October 6, 2010 (23:55) [EDIT: Sept. 27] The formula for variance has been corrected in Question 2. Otherwise, your task for this question remains exactly the same as before. Note that the sample session for this question remains the same as before. For your convenience, a2--errata.pdf explicitly highlights the changes in Question 2. This assignment covers material from UNITS 1–4 . You MUST do this assignment individually and, unless otherwise specified, you MUST follow all the general instructions and regulations for assignments. Graders have the discretion to deduct up to 10% of the value of this assignment for deviations from the general instructions and regulations. Part 1, Question 1: 0 points Part 1, Question 2: 0 points Part 2, Question 1: 25 points Part 2, Question 2: 30 points Part 2, Question 3: 45 points 100 points total Part 1 (0 points): Warm-up Do NOT submit this part, as it will not be graded. However, doing these exercises might help you to do the second part of the assignment, which will be graded. If you have difficulties with the questions of Part 1, then we suggest that you consult the TAs during their office hours; they can help you and work with you through the warm-up questions. Warm-up Question 1 (0 points) PS Books is a bookstore which not only sells books to individuals, but also sells school textbooks to the local school board. PS Books offers the following discount on orders which consist of multiple copies of the same textbook: Less than 10 copies: Full price Between 10 and 49 copies (inclusive): The price of each copy is reduced by 10% 50 copies or more: The price of each copy is reduced by 20% Write a program which consists of a single class called TextbookCostCalculator . This class defines a main() method which asks the user to enter the unit cost of the textbook, as well as the number of copies being ordered. The program then calculates the total cost of the order, taking any applicable discounts into consideration. Once the program has calculated the total cost of the order, it displays this value to the screen along with an explanatory message. 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Your program MAY assume that the values entered by the user are of the correct type and that they are in the proper range; in other words, your program does not have to handle the cases where a value entered by the user is invalid (such as a negative number of textbook copies, or a negative textbook unit cost). Use an integer variable to store the number of copies being ordered, but a floating point variable
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Assignment2 - ASSIGNMENT 2 Conditionals and Loops...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online