write a program that permits the user to order a


Write a program that permits the user to order a product from inventory. The user selects the product and enters the quantity. If there is sufficient quantity on hand of the product to fulfill the order:

1.  the price is retrieved from a product array,

2.  the cost (quantity * price) is calculated,

3.  the order information is displayed on the form,

4.  the quantity ordered is deducted from the inventory array,

5.  the order is written to an output file.

Otherwise, the user should be notified that there is an insufficient quantity on hand. The user must print preview the completed order (Product, Cost) before entering another order. And the user should not be able to print preview until an order has been processed. The user has the option to print preview a report (Product, Quantity on Hand, Price) of the current product inventory. The user ends the program by clicking exit. Download, unzip and run the executable Program 4 (Debug folder - right click and click "Open in New Window") to see what the interface could look like and what the functionality should be. There are two files included with the executable. Open (double click on the file name) the Products.txt before you run the program and the OrdersFile.txt files after you running the program and generating a few orders.

This program incorporates concepts and statements from all chapters but primarily from chapters 8 and 9.

Remove a product from BOTH the ProductRecord array and the product ListBox that is sold out (quantity = 0). Hint: Use concepts from the Bubble Sort (in Handouts) to remove a product from the inventory array.

Back your program up by making a copy of it on another device at the conclusion of each Visual Basic session.  Programs lost due to computer crashes or lost/broken jump drives that are submitted late will result in point deductions!  To back up the program, go to Windows Explorer and copy / paste the solution folder (the highest level folder where you see your program name) onto another device.  Do NOT do a FILE SAVE AS to save the program on another device as this will not copy all of the files that belong to the solution.

Requirements:

  • Name the folder/program using your initials and last name and program number, e.g., SmithCRProgram1 where a student's last name is Smith and initials are C.R.
  • Follow naming conventions for controls, constants and variables given in the book, i.e., use the appropriate prefixes to indicate type of control, data type of constants and variables, and scope of variables.
  • Follow documentation recommendations as demonstrated in the Test Scores program.
  • Begin all programs with your name, program number and program summary.
  • On the fourth Tab from the left edge, document the algorithm above the related line.
  • Include procedure headers as demonstrated in the Test Scores program.
  • Use asterisks for event procedure headers.
  • Use hyphens for any general procedure headers that you may include.
  • Follow code indentation conventions.
  • Incorporate design principles and user-friendly features into your interface.
  • Set the form's StartPosition property value to CenterScreen.
  • Set the form's Width property no larger than 400; the Height property no larger than 400 with your screen resolution set to 800 x 600 pixels.
  • Create and store in the bin/Debug folder of your project a sequential-access text file in Notepad containing the following data with one field per row:

Product                    Quantity          Price

A45                      2                 4.50

B24                      5                  2.40

C12                      3                  7.50

D78                      4                  8.20

E45                       6                  3.10

  • Define a ProductRecord structure that contains fields for Product, Quantity on Hand and Price. Declare and use an array of the ProductRecord structure to process orders. Read the data for the array in from the sequential-access text file in the form's Load event procedure.
  • Use a ListBox for the products. These products must be added from the array at the runtime. Do this in the form's Load event procedure.
  • Use a ComboBox to display the range of quantities. If you think that it would be fun, you may want to try to use NumericUpDown control (see Help) for entering the quantity instead of a ComboBox!
  • The product's price must be retrieved from the array.
  • In the Order button's Click event procedure, write the product number and cost to a sequential-access text file. You will have to close the file at the end of the procedure so that it can be reopened for the next order.
  • Use the button's .Enabled property to prevent the user from print previewing before ordering and not ordering again until the order has been print previewed.
  • Read Chapter 9 Discussion and the Chap9Movies program available for download in the discussion to learn how to print preview. You may use Chap9Movies as a model for printing the order and report in this program.
  • Include ToolTips for the Buttons.
  • Set Option Strict to On. Let Option Explicit stay set to On (default).
  • Declare and use variables declared at the appropriate scope and of the appropriate data type to store the results of the calculations prior to displaying them.
  • Use a Try Catch block to catch exceptions. Display appropriate error message(s).

Request for Solution File

Ask an Expert for Answer!!
Visual Basic Programming: write a program that permits the user to order a
Reference No:- TGS0205721

Expected delivery within 24 Hours