Guest User

Untitled

a guest
Jan 21st, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. public static void recordVehicleWeight()
  2.     {  
  3.         Scanner console = new Scanner (System.in);
  4.  
  5.         int searchResult;
  6.         String data;
  7.    
  8.         System.out.print("Enter booking ID: ");
  9.         data = console.nextLine();
  10.         searchResult = linearSearch(data);
  11.         if (searchResult != -1) // check if the booking ID found or not, -1 indicates not found
  12.         {  
  13.             if (searchResult != RVBooking)
  14.             System.out.println("Enter Vehicle Weight: ");
  15.             double weight = console.nextDouble();
  16.             if (bookings[searchResult].setVehicleWeight(weight))    // Set Vehicle weight
  17.                 System.out.println("Vehicle weight updated.");
  18.             else
  19.                 System.out.println("Invalid Weight.");
  20.  
  21.         } else
  22.             System.out.println("Error! Booking ID not found!");
  23.        
  24.     }
Add Comment
Please, Sign In to add comment