CSC 160 - Program 1

Assigned: Weds Jan 8, 2003

Design due: Mon Jan 13, 2003

Program due: Weds Jan 15, 2003

Program #1 is worth 50 points, 5% of your grade


Concepts

In this program you will use the following concepts:

  • Variables of type: string, float, and int
  • Use the cin object to get user input data
  • Use the cout object to output data to the screen
  • Use the getline() function and understand its known bug in Visual C++
  • Work with arithmetic operators

Description

You just got a job at the "DVD MegaStore". Your new boss, Mr. Harsh, has asked you to write a program to determine the pricing of DVD's that are ordered by customers. The DVD MegaStore's customers are typically video stores, and they therefore often order DVD's in bulk. Some customers receive a discount on their purchases.

Input

You will query the user for the input to your program. This information will be:

  1. The DVD title the customer wants to order
  2. The unit price of the DVD
  3. The quantity of DVD's requested by the customer
  4. The discount given to this customer

Processing

In the processing part of your program, you want to calculate the total cost for the order. The DVD title is not a part of the calculation. The unit price, quantity and discount are used to determine the total cost of the order.

For example, a customer who orders 30 "Austin Powers" DVD's at a unit price of $19.00 with a discount of 20% would pay:

30 DVD's * $19.00 * (1 - .20 discount) = $456.00

Output

The output of your program will be a recap of the order and a final price for the order. Here's an example session of what your program may look like (user input is in bold):

Welcome to the DVD MegaStore!

Enter the DVD title: Austin Powers

Enter the DVD unit price: 19

Enter the order quantity: 30

Enter the discount for this customer: 20

 

DVD MegaStore customer order:

  30 copies of "Austin Powers"

  Unit price is $19.00

  Order cost is $570.00

  Discount of 20% is $114.00

  Grand Total with discount is $456.00

Thank you for shopping at DVD MegaStore

 

 


Grading

Your program will be graded on three areas: design, quality, and function. Their description and weighting in your grade is given below.

1. Program Design (25%)

It is not acceptable to just sit in front of Visual C++ and pound out a solution. I know this particular assignment is simple, but I want to get in the habit of doing your design work before coding. Please submit the following on paper to show your design work:

  • Pseudo-code - English description of the important sections and decisions in your program.
  • Program fragments - You should be able to fill in your pseudo-code with program fragments.

This is due by the next class, Monday Jan 13.

2. Program quality (25%)

Giving the correct answer alone does not qualify as good programming practice. Your program should be well constructed and commented. I will look for:

  • Header comment - You must have a comment block at the top of each file with your name, the assignment, and a description of what the code in this file does.
  • Names - You must select informative names in your code. Names include variable names, function names, class names, etc. For example, in this program, "dvd_title" may be a good variable name... "ti" is not.
  • Style - This is a broad topic. How your program looks will impact how easy it is for others to understand. Visual C++ will help you with indentation. Use the style given in our text for capitalizing names or not. When still in doubt, ask me.
  • Comments - You must comment important blocks of code. I like commenting your pseudo-code right into your program. For now, please comment the purpose of most variables. Comments should be short and to the point.

3. Program function (50%)

Simple... does your program meet the requirements specified in the assignment. For this first assignment, you will not be expected to handle "bad" data, such as negative numbers or discounts of more than 100%. You can assume:

  • A valid DVD title
  • A DVD unit price > $0.00
  • A order quantity > 0
  • A discount >= 0 (a zero percent discount is valid)

After the due date, I will run your program on a number of examples.

Good luck.