In the student sample program files for this chapter, you will find a text file named house_prices.csv. The file contains the following data about houses for sale in a city: Price Number of bedrooms Number of bathrooms Square feet of living space The data stored in each line is formatted in the following way: Price,Bedrooms,Bathrooms,SquareFeet Notice that the data items are separated by commas. The first line in the file looks like this: 221900,3,1,1180 The data stored in this line is: Price = $221,900 Bedrooms = 3 Bathrooms = 1 Square feet = 1,180 Design a class that has properties for the four pieces of data. In an application, read the file and store each house’s data in an instance of the class. The class instances should be stored in a List. The application should let the user search the List for the prices of houses with the number of bedrooms within a range, the number of bathrooms within a range, and the square feet of living space within a range. For example, all houses with two to four bedrooms, two to three bathrooms, and 1,500–2,500 square feet of living space. The application should display the data for each house that matches the search criteria in a ListBox. Here are some tips: Use the Split method that we discussed in Chapter 8 to tokenize each line of the file into the four pieces of data. Use the FindAll method discussed earlier in this chapter to search the List." This is a homework problem that has to deal with reading a CSV file into a ListBox. I have spent a lot of time on this with no success. Some help would be greatly appreciated.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

"In the student sample program files for this chapter, you will find a text file named house_prices.csv. The file contains the following data about houses for sale in a city:

  • Price

  • Number of bedrooms

  • Number of bathrooms

  • Square feet of living space

The data stored in each line is formatted in the following way:

Price,Bedrooms,Bathrooms,SquareFeet

Notice that the data items are separated by commas. The first line in the file looks like this:

221900,3,1,1180

The data stored in this line is:

  • Price = $221,900

  • Bedrooms = 3

  • Bathrooms = 1

  • Square feet = 1,180

Design a class that has properties for the four pieces of data. In an application, read the file and store each house’s data in an instance of the class. The class instances should be stored in a List.

The application should let the user search the List for the prices of houses with the number of bedrooms within a range, the number of bathrooms within a range, and the square feet of living space within a range. For example, all houses with two to four bedrooms, two to three bathrooms, and 1,500–2,500 square feet of living space. The application should display the data for each house that matches the search criteria in a ListBox.

Here are some tips:

  • Use the Split method that we discussed in Chapter 8 to tokenize each line of the file into the four pieces of data.

  • Use the FindAll method discussed earlier in this chapter to search the List."

This is a homework problem that has to deal with reading a CSV file into a ListBox. I have spent a lot of time on this with no success. Some help would be greatly appreciated.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning