Assignment 3 – 60 marks.  

Changes

In the code where u've declared the array of artist names:
{"Picasso","Rembrandt"... etc}

Plz change it to:
{"Select one", "Picasso", "Rembrandt"....}

Everything else is same i.e. if the user has selected "Select One" then "Unspecified" should be entered in the database as artist name.   

=====================================================

For this assignment, construct the following database in MSAccess:

Table Name: Paintings

Fields: Name (String), Price (Number), Artist (String), Style (String).

 

Each painting in this database has a unique name. Also, the Price field cannot be left blank for any record. Create a DSN for this database. The DSN name must be ‘Gallery’.

 

Now add the following functionality to the GUIs you have created in Assignment 2 [for those whose assignment 2 was not running, mail 04020133@lums.edu.pk and a working code for assignment 2 would be sent to do assignment 3 on]:

 

Add Painting – [21 marks]

If the user enters information about a new painting and presses the Submit button in the Add Painting GUI, insert a new record in the database. While inserting the record, handle the following:

-         To the Price entered by the user, add to it the extra charges ($100) and delivery ($200), if the checkboxes are selected [2 marks].

-         If no painting style or artist name has been specified by the user, the field should be entered as “unspecified” [2 marks].

-         If no name / price has been entered then display an error message box “Name must be entered” / “Price must be entered”. If both have not been entered, display "Enter name & price" error message box [2 marks].

-         If the price entered is not an integer, display an error message box “Enter integer in price field” and do not insert any records [2 marks].

-         If the name entered is not unique, display an error message box “Name must be unique” and do not insert any records [3 marks].

-         If there is no error in user entry, insert record in database and display message “Painting inserted” [7 marks]. On clicking "OK" on this message box, all the fields in the Add Painting GUI should be cleared [5 marks]

 

Search Painting – [28 marks]

-         If the user clicks All then all the painting records should be retrieved from the database and display the painting’s name, price, artist’s name and style in the text area below [6 marks].

-         If the user clicks Name, Artist or Style, then enters a search string and presses enter, retrieve and display in the text area below all those records in the database whose field entry matches the search string entered by the user. This match should not be case sensitive [10 marks].

-         If the user clicks Price, then enters an integer in the search string and presses enter, retrieve and display in the text area below all those records in the database whose price is less than the specified price [4 marks]. If an integer is not entered, display “Price is an integer” error message box [2 mark].

-         If the user selects any option other than All and presses enter in the text field without entering any search string, display error message “Must specify search string” [2 marks].

-         The user should be able to make multiple searches without having to leave the Search Painting GUI, i.e. the results for the most recently executed search should be overwritten on the text area on every search query [2 marks].

-    For every search, headings for the each of the fields should also be shown as the first line of the text area. These should not be hard-coded, and you must use the getColumnName(int i) method in the ResultSetMetaData class to retrieve the column headings [4 marks].

 

Delete Painting – [11 marks]

For this, add another menu option Delete in the Search Painting menu (after the back & exit options) [3 marks]. When this option is selected, user is asked to enter a painting name using an input dialog box, the painting’s record is deleted if the name exists, and message box “Painting deleted” is displayed [6 marks]. If no painting by that name exists, display message box “No such painting exists” [2 marks]. Note that whatever the user enters would not be case-sensitive, i.e. the user should not be concerned with entering information in the correct case.

 

 

Submission –

The assignment is due 5:00 last day before dead-week starts. Late submissions however, would be accepted without any grade reduction till Friday 11:59 pm J.