A property dealer deals with buying and selling of 2 kinds of properties, independent houses and apartments that are present in various cities within a state. The properties in each city have different minimum and maximum rates per square feet of covered area that are fixed by the land revenue department of the state. The minimum and maximum rates are always higher for independent houses as compared to apartments. Each dealer has to buy and sell properties at rates within that range. Both houses and apartments are identified by a plot number, street name, city name, the square feet of covered area and the per square feet rate that the dealer has fixed to sell. The houses have additional properties like the number of floors and the total plot size, whereas the apartments have an additional property, named type that states whether it is a 1BHK, 2BHK, 3BHK or 4BHK apartment. You have to develop a system that will support the following functionalities. 1. Add city details 2. Add property details 3. Search properties: This option allows the users to specify 3 things (a) City: User enters the name of the city. (b) Property type: User will type one of the 3 options, ”ANY” if he has no specific choice, ”HOU” if he wants house, or ”APT”, if he wishes apartment. (c) Budget range: The user will provide as input, either ”ALL” or the range of total maximum price of the property, not the square feet price. This is given in format 0-1000000, or 200000-1000000. 4. Filter Previous Search: This option will not be displayed in the main menu. If the previous option provided by the user was ”Search properties” and the ”Property type” was not ”ANY” , then only this option will only be shown, after displaying the search results. Prompt the user to press ’y’ for yes if he wants to filter the previous search results or ’n’ for otherwise. If the user types ’y’ and in the previous search, user has provided ”HOU”, then prompt the user to enter the ”Total Plot Area”. If in the previous search user has provided ”APT”, then prompt him to enter the ”Type”. Filter the previous search results on the basis of the input provided and show the results.
import java.util.ArrayList; import java.util.Scanner; class home{ public static void main(String args[]) { ArrayList<City> city = new ArrayList<City>(); ArrayList<property> property = new ArrayList<property>(); Scanner vinnu = new Scanner(System.in); while(true) { System.out.print(" 1.ADD CITY\n 2.ADD PROPERTY DETAILS \n 3.CHOICES \n PLEASE ENTER YOUR CHOICE ="); int choice = vinnu.nextInt(); System.out.print("\n "); switch(choice) { case 1 : System.out.print(" PLEASE ENTER YOUR STATE = "); String state_name = vinnu.next(); vinnu.nextLine(); System.out.print(" PLEASE ENTER YOUR CITY = "); String city_name = vinnu.next(); System.out.print("\n "); city.add(new City()); break; case 2 : System.out.print(" PLEASE ENTER YOUR PLOT NUMBER = "); String state_name1 = vinnu.next(); System.out.print(" PLEASE ENTER YOUR CITY = "); String city_name1 = vinnu.next(); System.out.print(" PLEASE ENTER YOUR STREET NAME = "); String street_name = vinnu.next(); System.out.print(" PLEASE ENTER SQUARE FEET OF AREA COVERED = "); String area = vinnu.next(); System.out.print(" PLEASE ENTER RATE FOR SQUARE FEET = "); String rate = vinnu.next(); System.out.print("\n "); property.add(new property()); break; case 3: while(true) { System.out.print(" 1.CITY\n2.PROPERTY TYPE\n3.BUDGET RANGE\n4.exit(1)\n PLEASE ENTER YOUR CHOICE = "); int choice1 = vinnu.nextInt(); vinnu.nextLine(); System.out.print("\n "); switch(choice1) { case 1 : System.out.print(" PLEASE ENTER YOUR CITY = "); String city_name2 = vinnu.nextLine(); System.out.print("\n "); break; case 2: System.out.print("1.ANY\n2.HOU\n3.APT "); int choice2 = vinnu.nextInt(); vinnu.nextLine(); if(choice2==2||choice2==3) { System.out.print("PRESS 'Y' FOR FILTER SEARCH OR 'N' OTHERWISE = "); String choi= vinnu.nextLine(); if(choice2==2 ) { System.out.print("ENTER THE TOTAL PLOT AREA = "); int parea=vinnu.nextInt(); } else { System.out.print(" ENTER THE TYPE = "); } } System.out.print("\n "); break; case 3: System.out.print("ENTER THE BUDGET = "); System.out.print("\n "); break; case 4 : exit(1); break; } } // System.out.println("\n "); } } } private static void exit(int i) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } private static class City { public City() { String state_name; } } private static class property { String state_name, city_name,street_name,rate,area; public property() {} } }
A property dealer deals with buying and selling of 2 kinds of properties, independent houses and apartments that are present in various cities within a state. The properties in each city have different minimum and maximum rates per square feet of covered area that are fixed by the land revenue department of the state. The minimum and maximum rates are always higher for independent houses as compared to apartments. Each dealer has to buy and sell properties at rates within that range. Both houses and apartments are identified by a plot number, street name, city name, the square feet of covered area and the per square feet rate that the dealer has fixed to sell. The houses have additional properties like the number of floors and the total plot size, whereas the apartments have an additional property, named type that states whether it is a 1BHK, 2BHK, 3BHK or 4BHK apartment. You have to develop a system that will support the following functionalities. 1. Add city details 2. Add property details 3. Search properties: This option allows the users to specify 3 things (a) City: User enters the name of the city. (b) Property type: User will type one of the 3 options, ”ANY” if he has no specific choice, ”HOU” if he wants house, or ”APT”, if he wishes apartment. (c) Budget range: The user will provide as input, either ”ALL” or the range of total maximum price of the property, not the square feet price. This is given in format 0-1000000, or 200000-1000000. 4. Filter Previous Search: This option will not be displayed in the main menu. If the previous option provided by the user was ”Search properties” and the ”Property type” was not ”ANY” , then only this option will only be shown, after displaying the search results. Prompt the user to press ’y’ for yes if he wants to filter the previous search results or ’n’ for otherwise. If the user types ’y’ and in the previous search, user has provided ”HOU”, then prompt the user to enter the ”Total Plot Area”. If in the previous search user has provided ”APT”, then prompt him to enter the ”Type”. Filter the previous search results on the basis of the input provided and show the results.
Reviewed by Unknown
on
03:50
Rating:
Thanks for sharing. Great post very Informative, also checkout Cash For Gold,
ReplyDelete