SHARE
TWEET

Untitled

a guest Nov 18th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. package javaapplication10;
  8.  
  9. /**
  10.  *
  11.  * @author RamonGaming
  12.  */
  13. import java.util.Scanner;
  14.  
  15. public class JavaApplication10 {
  16.  
  17.     /**
  18.      * @param args the command line arguments
  19.      */
  20.     public static void main(String[] args) {
  21.         // TODO code application logic here
  22.         DelegateHash testHash = new DelegateHash();
  23.         Scanner inp = new Scanner(System.in);
  24.        
  25.         boolean running = true;
  26.         while (running){
  27.             int loadFactor = testHash.loadFactor();
  28.             System.out.println("Load Factor:" + loadFactor);
  29.             System.out.println("D)isplay  P)ut  G)et  C)ontains  S)ize  R)emove  Q)uit?");
  30.             testHash.loadFactor();
  31.             String menu = inp.nextLine();
  32.        
  33.         if(menu.equals("P")){
  34.             System.out.println("Enter name: ");
  35.             String name = inp.nextLine();
  36.             System.out.println("Enter Affiliation: ");
  37.             String affil = inp.nextLine();
  38.            
  39.             Delegate test = new Delegate(name, affil);
  40.             testHash.put(test);
  41.            
  42.     }
  43.         else if(menu.equals("D")){
  44.             testHash.displayDB();
  45.            
  46.        
  47.     }
  48.         else if(menu.equals("G")){
  49.             System.out.println("Enter name: ");
  50.             String name = inp.nextLine();
  51.             testHash.get(name);
  52.        
  53.     }
  54.         else if(menu.equals("C")){
  55.              System.out.println("Enter name: ");
  56.              String name = inp.nextLine();
  57.              boolean contains = testHash.containsName(name);
  58.              if (contains){
  59.                   System.out.println("Contains: " + name);
  60.              }
  61.            
  62.        
  63.     }
  64.         else if(menu.equals("S")){
  65.             testHash.size();
  66.            
  67.        
  68.     }
  69.         else if(menu.equals("R")){
  70.             System.out.println("Enter name: ");
  71.             String name = inp.nextLine();
  72.             testHash.remove(name);
  73.        
  74.     }
  75.         else if(menu.equals("Q")){
  76.             running = false;
  77.            
  78.        
  79.     }
  80.        
  81.        
  82.    
  83.    
  84.        
  85.    
  86. }
  87. }
  88. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top