Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab #2 - Book Sale Calculator Submit Assignment Download Work file Download Runtime Be sure to include comments at the top of each procedure and

Lab #2 - Book Sale Calculator

Submit Assignment Download Work file Download Runtime

  • Be sure to include comments at the top of each procedure and at the top of the file.
  • Be sure to use meaningful names for all buttons and labels.
  1. In this project, R 'n R Refreshment needs to expand the book sale project done previously. In addition to calculating individual sales and discounts, management wants to know the total number of books sold, the total number of discoutns given, the total discounted amount, and the average discount per sale. Add error handling to the program, so that missing or nonnumeric data will not cause a run-time error.
  2. Planning the Form
  3. Planning Objects and Properties
    Object Property Setting
    Main Form Name BookSaleForm
    Text R 'n R - For Reading and Refreshment
    StartPosition CenterScreen
    AcceptButton CalculateButton
    CancelButton ClearButton
    Label1 Text Book Sales
    Font Bold, 12 point
    GroupBox1 Text blank
    Label2 Text &Quantity
    QuantityTextBox Name QuantityTextBox
    Text blank
    Label3 Text &Title
    TitleTextBox Name TitleTextBox
    Text blank
    Label4 Text &Price
    PriceTextBox Name PriceTextBox
    Text blank
    GroupBox2 Name GroupBox2
    Text blank
    Label5 Text Extended Price
    ExtendedPriceTextBox Name ExtendedPriceTextBox
    Text blank
    ReadOnly true
    TextAlign Right
    Label6 Text 15% Discount
    DiscountTextBox Name DiscountTextBox
    Text blank
    ReadOnly true
    TextAlign Right
    Label7 Text Discounted Price
    DiscountedPriceTextBox Name DiscountedPriceTextBox
    Text blank
    TextAlign Right
    ReadOnly true
    Calculate Button Name CalculateButton
    Text &Calculate
    ClearButton Name ClearButton
    Text Clear &Sale
    ExitButton Name ExitButton
    Text E&xit
    GroupBox3 Name GroupBox3
    Text Summary
    Label8 Text Total Number of Books
    QuantitySumTextBox Name QuantitySumTextBox
    Text blank
    ReadOnly true
    TextAlign Right
    Label9 Text Total Discounts Given
    DiscountSumTextBox Name DiscountSumTextBox
    Text blank
    ReadOnly True
    TextAlign Right
    Label10 Text Total Discounted Amounts
    DiscountedAmountSumTextBox Name DiscountedAmountSumTextBox
    Text blank
    ReadOnly true
    TextAlign Right
    Label11 Text AverageDiscount
    AverageDiscountTextBox Name AverageDiscountTextBox
    Text blank
    ReadOnly true
    TextAlign Right
  4. Planning Event Procedures
    Procedure Actions - Pseudocode
    ExitButton_Click End the project
    ClearButton_Click Clear each text box except Summary fields
    Set the focus in the first text box
    CalculateButton_Click Declare the variables
    Try Convert the input Quantity to number. Try Convert the input Price to numeric Calculate Extended Price = Quantity * Price Calculate Discount = Extended Price * Discount Rate Calculate Discounted Price = Extended Price - Discount Calculate the summary values: Add Quantity to Quantity Sum Add Discount to Discount Sum Add Discounted Price to Discounted Price Sum Add 1 to Sale Count Calculate Average Discount = Discount Sum / Sale Count Format and display sale output Format and display summary values Catch any Price exception Display error message and reset the focus to Price Catch any Quantity Exception Display error message and reset the focus to Quantity Catch any generic exception Display error message

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions