Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Objectives - practice the following concepts:

  • ArrayList of objects as the "internal database" - referred to below as the DB [NOTE: This is NOT a true database in terms of what we usually means in computing, managed by a database management system like MySQL or Oracle]
  • "Rapid Prototyping" to develop a program which is easily expandable in the future
  • User options menu
  • Input data from both a file and interactive user
  • Reading/Editing of user input (done in setters)
  • "Automatic" loading/saving of backup file data from/to the internal DB at the start/end of the program
  • Using the same file name for input file and output file (so output over-writes input file - CAUTION !!!)
  • Searching the DB for a single matchand for multiple matches
  • Adding and removing data from the DB

PROJECT BACKGROUND   A family friend wants you to develop a quick prototype program to help her keep track of the houses/condos she's looking at in her search to buy a new home.  You'll likely expand the program in the future (not in CS1110) to add such things as:

  • other data fields for each house
  • capability to search on other fields
  • betterediting, repeatedly asking user for correct data, etc.
  • adding pictures as fields
  • changing the internal "database" to EXTERNAL storage structures like hash files and indexed files instead (in CS3310 - Data & File Structures)
  • changing the storage structure to use an ACTUAL DATABASE using actual database management system software instead (in CS4430 - Database Systems) like MySQL or Oracle to store/access the data

PROJECT OVERVIEW (for asgn 8)This OOP program keeps a DBof houses for searching/updating/printing by the interactive user.  The data is stored in a .csv file for permanent storage while the program is NOT running.  It is automatically loaded into internal storage, the DB, (the ArrayList of objects) when the program starts, so that it can be searched more quickly.  The user is repeatedly presented with a menu of search (and other) options, which the program handles for them.   When the user is finished, the DB is dumped back to the same .csv file, since there may now be additional houses in the DB, or houses which were removed from the DB. 

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

The DB MUST be implemented as an ArrayList of House objects.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

DATA FILEHouseDB.csvNo header record.  The data here needs no cleaning/editing (unlike the data from the user for option 5 which DOES need cleaning/editing).  Each record contains these fields in this order:

                stAdr                      -street address uniquely identifier a particular house or condo

                city                         

sqFt                         - a positive integer between 100-5000 inclusive

numBR                   - number of bedrooms - a positive number between 0-5 inclusive

price                       - selling price - a positive integer between 10000 and 300000 inclusive

 

CAUTION !!!This file is both the INPUT file and the OUTPUT file.  So while you're testing, you should write to a DIFFERENT OUTPUT FILE - otherwise you'll keep LOSING your INPUT FILE DATA.   Once your program works, change the output file name to be the same as the input file.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * *

THE MENU OF QUERY OPTIONS

The menu is repeatedly presented to the user.  Use JOptionPane windows for user interaction.  Menu includes:

1)       search by street address (which uniquely identifies a particular house/condo - so results in 0 or 1 hit)

2)       search by size (which results in 0/1/many hits)

3)       search by number of bedrooms (which results in 0/1/many hits)

4)       list all houses

5)       add a new house

6)       remove a house

7)       done querying DB

The program then provides the user with the appropriate response.

Other INPUT the user provides (when prompted):

                For option 1          - street address (like 123 Hardy)

For option 2          - number of square feet (the threshold like 1400)

                                                                AND whether they want larger (>=) or smaller (<=) than that threshold number

For option 3          - number of bedrooms (like 3, or 0 for a studio type condo)

For option 5          - the following fields (separately):    stAdr, city, sqFt, numBR,  price

For option 6          - street address

 

Output (prompts) to user - in JOptionPane windows:

                For option 1/2/3/4              - the prompts to get the user input (see above)

                For option 5                          - the 5 prompts for the 5 fields (individually)

                For option 6                          - the prompt for the street address

 

Output (responses) to user - to the Console Window:

[NOTE:  I'm showing specific addresses, etc. just to demo the format.  Use the address/sqFeet/etc. that the user specified for the query]

                For option 1                          - TARGET:  12 Miller Rd.

For option 2                          - TARGET:  >= 1,400 sq. feet

For option 3                          - TARGET:  3 bedrooms

For option 4                          - LIST OF ALL HOUSES                    

For option 1/2/3/4              - all 5 fields nicely formatted (some spacing between fields,

include , in sqFt, include $ and , in the price)

                For option 5                          - reassurance message:      OK, house at 15 Fulton St. added

                For option 6                          -reassurance message:       OK, house at 2 Main St.removed

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

EDITING INPUT DATA:

A.       The data in the FILEis already correct - so put this data in the DB by using the object constructor (5 parameters) for each object (house) you create.

B.       The data from the interactive USER needs editing before it's stored.  So use the 5 setters for this.  Each setter

1)       uses a DialogBoxwindow (with prompt) to get the data from the user

2)       For sqFt, numBR, price fields

a.        checks that the user data is numeric/positive/integer/withinRange:

That is:                   sqFt         - a positive integer between 100-5000 inclusive

numBR   - a positive number between 0-5 inclusive

price       - a positive integer between 10000 and 300000 inclusive

b.       If data is wrong, itdisplays a MessageBox window indicating there's an error and what DEFAULT VALUE the program will automatically use:

That is:                   sqFt         - 1500

                                numBR   - 2

                                price       - 150000

3)       Stores the data in the instance variable

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

PROGRAM STRUCTURE

4 .java files for these 4 classes (containing the methods specified - perhaps additional methods too)

1)       The main program containing the main method, showMenu method                                                           

2)       A Utility class with2 static methods:  loadFileToDB and dumpDBToFile                                              

3)       A QueryHandler class of 6 static methods, one for each of the first 6 options:                                                       doAddressSearch, doSizeSearch, doBRSearch,                           listHouses, addHouse, removeHouse

4)       The OOP House class contains:   instance variables,

setters (for user data editing/setting), a constructor (for file data "setting"),

toString method (prepares a .csv record for file),   prettyPrint method (for option 1/2/3/4 printing)

NOTE:  Any of these classes could contain additional methods to further modularize the program.

Attachment:- HouseDB.rar

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92394886
  • Price:- $15

Priced at Now at $15, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question research and provide a write up on available

Question : Research and provide a write up on available routers and switches. The report should include information for at least two router and two switching devices. Included in the write-up should be a description of t ...

Explain why a u s recession that occurs as the rest of the

Explain why a U. S. recession that occurs as the rest of the world is expanding will tend to reduce the U. S. Trade deficit.

What is the solution for chapter 15 3e for java programming

What is the solution for chapter 15 3e for java programming 8th edition Create a JFrame that holds fjive buttons with the names of five different fonts. Include a sexth button that the user can click to make a font large ...

Wildhorse inc has outstanding bonds that will mature in six

Wildhorse, Inc., has outstanding bonds that will mature in six years and pay an 8 percent coupon semiannually. If you paid $1,009.52 today and your required rate of return was 7.0 percent.  (Round intermediate calculatio ...

Question the sunshine health corporation would like you to

Question : The Sunshine Health Corporation would like you to provide an updated explanation and reference guide on 802.11 standards and specifications. Briefly explain the advantages and disadvantages of each. If you loc ...

Research ways that information systems have been misused

Research ways that Information Systems have been misused. Using the Internet, find an example of an organization that has misused Information Systems. Post your response to the discussion board. Respond to the following ...

Using c language how to write a function name bsqrt that

Using C++ language, how to write a function name bsqrt that will compute the square root of a number using the Babylonian method. This function will take the number x to compute the square root for and the number of iter ...

In 2009 the hershey company of pennsylvania became the

In 2009, the hershey company of pennsylvania became the latest company to open a candy factory in mexico, joining other american candy companies including brach's confections and ferrara pan candy, which had opened plans ...

Question what specific benefits does the ebk provide to any

Question : What specific benefits does the EBK provide to any organization? Why are those particular benefits important to the overall organization? Specifically, what is it about the EBK that makes it particularly usefu ...

Assume that the pizza market consists of two firms conans

Assume that the pizza market consists of two firms, Conan's and Pizza Hut. The price of a Conan pizza is denoted by Pc and the price of a Pizza Hut Pizza is P h.  Both sellers have a marginal cost of $5 for another pizza ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As