SHARE
TWEET

Untitled

a guest Mar 19th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class SymbolPair
  2. {
  3.     private String tickerSym;
  4.     private String  companyName;
  5.    
  6.     public SymbolPair(String ticker, String name)
  7.     {
  8.         tickerSym = ticker;
  9.         companyName = name;
  10.     }
  11.    
  12.     public String getTickerSymbol()
  13.     {
  14.         return tickerSym;
  15.     }
  16.    
  17.     public String getCompanyName()
  18.     {
  19.         return companyName;
  20.     }
  21.  
  22. }
  23.  
  24.  
  25.  
  26.  
  27. public class SymbolTable
  28. {
  29.     private SymbolPair[] symbolPairs;
  30.     private int numSymbols;
  31.    
  32.     public SymbolTable(File file) throws IOException
  33.     {
  34.         String line = " ";
  35.         Scanner scan = new Scanner(System.in);
  36.        
  37.     }
  38.    
  39.     public String findCompany(String str)
  40.     {
  41.         String company = "Does Not Exist";
  42.         for(int i = 0; i < symbolPairs.length; i++)
  43.         {
  44.             if(str.equals(symbolPairs[i].getCompanyName()))
  45.                 company = str;
  46.         }
  47.         return company;
  48.     }
  49.    
  50.     public String toString()
  51.     {
  52.         String str = " ";
  53.         for(int i = 0; i < symbolPairs.length; i++)
  54.         {
  55.             str += symbolPairs[i].getTickerSymbol() + symbolPairs[i].getCompanyName() + "\n";
  56.         }
  57.         return str;
  58.     }
  59.  
  60. }
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
 
Top