[Solved]Create Pseudocode Already Completed Program Code Someone Please Help Public Class Listing Q37169060
Create the pseudocode for an already completed program/code. Cansomeone please help me with this ?
public class Listing {
private String address;
private double price;
private double beds;
private double baths;
private double squareFeet;
public Listing(String address, double price, double beds, doublebaths, double squareFeet) {
this.address = address;
this.price = price;
this.beds = beds;
this.baths = baths;
this.squareFeet = squareFeet;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getBeds() {
return beds;
}
public void setBeds(double beds) {
this.beds = beds;
}
public double getBaths() {
return baths;
}
public void setBaths(double baths) {
this.baths = baths;
}
public double getSquareFeet() {
return squareFeet;
}
public void setSquareFeet(double squareFeet) {
this.squareFeet = squareFeet;
}
public boolean isMatch(double beds, double baths, doublesquareFeet, double price){
return this.beds == beds
&& this.baths == baths
&& this.squareFeet == squareFeet
&& this.price == price;
}
@Override
public String toString(){
return String.format(“%s, asking price $%.2f”,address, price);
}
}
MAIN
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
public class HouseFinder {
public static void main(String[] args) {
// Here are some variables that have been declaredfor you, don’t change them.
String LISTINGS_FILENAME = “listings.csv”;
Scanner scanner = new Scanner(System.in);
Listing[] listings;
int numberOfListings;
// TODO: Declare any additional variables you needhere.
System.out.println(“Welcome to House Finder!”);
System.out.println(“nLoading the listingsfile…”);
listings = inputFile(LISTINGS_FILENAME);
numberOfListings = listings.length;
System.out.println(“nPlease answer a few questionsso we can find the best options for you.”);
//#2get user input
double bedrooms = promptForDouble(scanner, “What isthe minimum number of bedrooms you would like?”);
double bathrooms = promptForDouble(scanner, “What isthe minimum number of baths you would like?”);
double squareFootage = promptForDouble(scanner,”What is the minimum square footage youwould like?”);
double price = promptForDouble(scanner, “What is themaximum price you are willing to pay?”);
System.out.println(“nHere are the options that meetyour criteria.”);
int matchCount = 1;
int lowestCostIndex = -1;
double lowestCost = Double.MAX_VALUE;
for(int i = 0; i < numberOfListings; i++) {
Listing l = listings[i];
if(l.isMatch(bedrooms, bathrooms,squareFootage, price)){
System.out.printf(“%d.%sn”, matchCount, l.toString());
matchCount++;
//finding lowest cost
if(l.getPrice() <lowestCost) {
lowestCost =l.getPrice();
lowestCostIndex= i;
}
}
}
//making sure only one lowest cost
if(matchCount == 1){
System.out.println(“No matchesfound”);
} else {
System.out.println(“nHere is the lowestcost option that meets your criteria.”);
System.out.println(listings[lowestCostIndex].toString());//(listings[i].toString()); before i changed
}
scanner.close();
}
//#1 make function that takes Scanner obj and a prompt
private static double promptForDouble(Scanner s, Stringprompt){
while(true) {//Enter infinite loop
System.out.print(prompt);//printprompt
try{//try to return a double value fromthe scanner
return s.nextDouble();//Ifit succeeds, we return the value and exit originalreturn s.nextDouble();
} catch(Exception ex) {//Exceptionoccurred
//The parsing failed, notify theuser
System.out.println(“Invalidinput”);
} finally {//Clear the scanner for thereprompt
s.nextLine();
}
}
}
/*
* Reads a file of listings and returns an array ofListing objects.
*/
private static Listing[] inputFile(String fileName) {
List<Listing> listings = newLinkedList<Listing>();
try (BufferedReader br = new BufferedReader(newFileReader(fileName))) {
String line;
while ((line = br.readLine()) != null) {
String[] values =line.split(“,s”);
Listing listing =
new Listing(values[0],Double.parseDouble(values[1]), Double.parseDouble(values[2]),
Double.parseDouble(values[3]),Double.parseDouble(values[4]));//I changedDouble.parseInt(values[4])) to double.parseDouble if thatsokay?
listings.add(listing);
}
} catch (Exception e) {
System.err.println(“Not able to readfile.”);
System.err.println(e);
System.exit(1);
}
return listings.toArray(new Listing[0]);
}
}
Expert Answer
Answer to Create the pseudocode for an already completed program/code. Can someone please help me with this ? public class Listing… . . .
OR

