Jihad-R / hotels-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hotel Finder

This console application allows users to search a list of hotels. Users have the ability to:

  1. List all hotels
  2. Search by state
  3. Search by price
  4. Add a new hotel

Interesting Code

An interesting piece of code in this application. Instead of looping through the entire array, I used a counter variable to keep track of the last position that a hotel was added. Each loop then uses that counter to determine how many times to loop.

 for (int i = 0; i <= counter; i++)
 {
     Hotel hotel = hotels[i];
     // only include hotels in the state that the user entered
     if(hotel.getPrice() >= min && hotel.getPrice() <= max)
     {
         displayHotel(hotel);
     }
 }

CLI Screens

Home Screen

Home Screen

List All

List All Hotels

Search by State

Search Hotels by State

Search by Price

Search Hotels by Price

Add Hotel

Add Hotel

About


Languages

Language:Java 100.0%