Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The fourth programming project involves writing one program to manage a real estate database. This program should be comprised of an enumerated type, an interface,

Thefourth programming projectinvolveswriting one programto manage a real estate database. This program should be comprised of an enumerated type, an interface, and two parts. The enumerated type should be named Status and should contain three enumeration literals, FOR_SALE, UNDER_CONTRACT and SOLD.

The interface should be a generic interface namedStatusChangeableand it should have a bounded generic type parameter whose type must be an enumerated type. It should contain one abstract methodchangeStatusthat has a parameter whose type is the generic type parameter.

The first part of the program is a class namedProperty. Among the processes are the implemented is theStatusChangeableinterface. The elements for the property should contain variables:

  1. The parcel id as integer
  2. The property address stored as a string
  3. The number of bedrooms stored as integer
  4. The square footage stored as integer
  5. The property price stored as integer
  6. The status of the property whose type should be the enumerated type Status with the equivalent integers of 0, 1, and 2.

In addition, it should have the following three methods:

  1. Aconstructorthat accepts six parameters for the purpose of initializing the characteristics of the property, specifically
  2. Parcel id
  3. Property address
  4. Number of bedrooms
  5. Square footage
  6. Property price
  7. Status

The status of the property should be set to FOR_SALE (0).

  1. A method namedchangeStatusthat allows the status of the property to be changed.
  2. An overriddentoStringmethod that returns a string containing the parcel id, property address, number of bedrooms, square footage, property price, and current status appropriately labeled.

The second part of the program is a Program Core and containsthemain ()method. In addition, it should contain a class variable for the Property class that defines the database of property records, which is implemented as aHashMap, with the parcel id field (Integer) as the key and a Property object as the value. For consistency and feedback, there is aPRJ4Property.txtdata file to use with this project that contains all the data necessary to begin the program. Directly read the data file (PRJ4Property.txt) into the program and assign the values to the HashMap. [In the program the name of the data file is entered with the relative path name, not the absolute path. See Note at end of this document for clarification.] For documentation, a Transaction array is declared to hold the processing implemented during the running of the program. Insert, delete, find, and change status are the transaction during the processing of the program. These are tags for each transaction followed by the appropriate information about the transaction. So, the fields in the Transaction array begin with the processing transaction, then the parcel id and the remaining values in the HashMap.

The data file is read into the program and assigned into aHashMap. As each record is assigned, the program also displays the records of the data file using the toString() method in the IDE Output Window.

The program should generate the GUI shown below:

The default process is Find. The default Change Status is FOR_SALE. Clicking theProcessbutton should cause the selected choice of the three actions in the combo box to its right [Find, Insert, Delete] to be executed. When using the insert process to add a new property, the program should check for any non-integer values that may have been entered in any of the fields that require integers.

The following error messages should display in a JOptionPane window:

  1. After entering a number in theParcel IDTextField if the number is not in the database a message stating that fact is displayed. The message should also display if the user clicks on theProcessbutton before any value is entered in theParcel ID.
  2. When theProcessbutton is clicked, the program checks that there is an integer for theParcel IDin the database. When the Insert process is implemented, there is a check for integers inBedrooms,SquareFootage, andProperty PriceTextFields. Each message references to a specific TextField.
  3. If the user attempts to insert a Parcel ID, a key, that is already in the database.
  4. If the user attempts to delete or find a record that is not in the database. [Related to #1.]

After each successful operation is completed a JOptionPane window displays confirming the success. In the case of a successfulFindrequest, a window should pop up containing all the information in the associated Property object using the toString() method.

Clicking theChange Statusbutton should cause status of the property associated with the designatedParcel IDto be changed to status selected in the combo box to its right. TheChange Statusshould be implemented any time there is a parcel in the window. A JOptionPane window displays a confirmation of the change.

Include aClearand anExitbutton on the GUI Interface.

Each activity that the user performs is recorded in a Transaction array. The fields in the array include the transaction process, parcel id, property address, number of bedrooms, square footage, property price, and process/change of status activity.

When the program ends, there are two displays of information displayed in the IDE Output Window. The first set of data are the records in the Transaction array are displayed using the toString() method in the IDE Output Window following theTransactions Completedtag. [For each process action performed by the user, there is a transaction record.] After the transactions, the second set of data display the newly modified HashMap of the original set of data in the IDE Output Window tagged asModified Databasedisplayed using the toString() method on the Property objects.

Use Java.

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

6 What are the five main printing processes?

Answered: 1 week ago

Question

Illustrate Concurrent execution of transaction with examples?

Answered: 1 week ago

Question

Divide and rule ?

Answered: 1 week ago