ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 8 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 19 May 2017 My Price 8.00

A barcode, description, stock level and price

Write a GUI application that records items of stock for a business. A barcode, description, stock level and price are recorded for each item. New items must be able to be added, and existing items must be able to be changed or deleted. The main window should have a menu bar, with menus File and Edit. The File menu should have options Open, Save and Exit, and the Edit menu should have options to Add, Change and Remove. The main window should also have a toolbar (directly under the menu bar) with a toolbar button for each of these options. See Figure 1. 

Figure 1 The following should occur when the user chooses each of the options: Open: A file dialog should be displayed, allowing the user to select the name of a text file containing all the items captured previously. Save: A file dialog should be displayed, allowing the user to select the name of the text file in which the items captured thus far should be saved. Exit: The program should exit. If the data has been changed since it was last saved, the program should warn the user and allow the data to be saved if required.

COS2614/101 

15

Add: A dialog should be displayed consisting of a form that allows the user to specify the barcode, description, stock level and price of an item. If the user attempts to add an item that has been added previously, the program should tell the user that an item with this barcode already exists, and ask whether the stock should be increased. Change: A dialog should be displayed allowing the user to specify a barcode. Another dialog must then be displayed with a form already populated by the data for that item. The user should be allowed to change any of the fields except the barcode. Remove: A dialog should be displayed allowing the user to specify a barcode. If an item with the barcode exists, the user should be asked for confirmation before it is deleted. In the centre of the window, a list of all the items should be displayed, sorted in order of their barcodes, and should reflect any changes made by performing the options. See Figure 2. 

Figure 2

Implementation requirements: • You may not use Qt Designer to create the user interface. You must code the GUI manually. • You should adhere to good design principles and your program should provide user-friendly feedback to the user. • The program must separate the model from the view. The model consists of the non-visual classes used to create, edit and store the items in stock. The view consists of the graphical user interface including the main window with the menus, toolbar and edit box, and the other dialog boxes that are displayed. • You must use a QMap to store the items in stock in the order of their barcodes. Note that this is part of the model, so the QMap should not be stored in, or be directly accessed by, the view. All access to it should be through the operations provided by the model. • Opening a file to load the items in stock into the model, and saving the items in stock in a file, are part of the model. The view code should therefore not do any file handling – this should all be managed by the model. • We have provided Item, ItemReader and ItemWriter classes (in Additional Resources) for part of the model. You must use these classes without changing them. 

Hints: You can use a static member function of QFileDialog to allow the user to choose a file to open or to save. 

Remember that you must submit a program that compiles correctly and displays something on the screen, to obtain marks for this question. (See Section 5.2 of this tutorial letter.) This is a complex application to complete, so we recommend that you build it incrementally, making sure that each new feature compiles and works correctly before adding the next feature. 

 

16

Approximately a third of the marks will be allocated to the model. Another third will be allocated to the view, and the remaining marks will be allocated to the functionality of linking the model to the view.  

Setting up the view is not difficult. The tricky bit is to get the toolbar buttons to perform the same actions as the options on the menus. You should be able to design and implement the model fairly easily with the knowledge you have gained from the first two assignments. The trickiest part is linking the model and view together, so that any actions on the view change the model, and that any changes to the model are reflected in the view. 

Questions 2, 3 and 4 of Part B of this assignment develop parts of the solution to this question. We suggest you try them before tackling this one. 

Answers

(11)
Status NEW Posted 19 May 2017 05:05 AM My Price 8.00

-----------

Not Rated(0)