Advertisement
ivana_andreevska

Random od AV4 i Lab1

Aug 9th, 2022
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. FlatAmountProvisionTransaction(long fromId, long toId,String amount, String flatProvision) кој го иницијализира полето за опис на "FlatAmount" и соодветен get метод
  2.  
  3. sega treba da zemam obicen konstruktor t.e prvicen e
  4.  
  5. public FlatAmountProvisionTransaction(long fromId, long toId, String description, String amount) {
  6. super(fromId, toId, description, amount);
  7. }
  8. i na mestoto na amount treba da stoi FlatAmount
  9.  
  10. i da izgleda vaka
  11.  
  12.  
  13. AKO SAKAME ID DA SE ZGOLEMUVA SEKVENCIJALNO
  14. private String accountOwner;
  15. private int id; //se odnesuva na momentalna smetka //se cuva lokalno na nivo na account
  16. private static int idSeed=1; //se cuva na nivo na klasa //static oti e na nivo na klasa a i dr klasi ke nasleduvaat od account
  17. private double currentAmount;
  18.  
  19. public Account(String accountOwner , double currentAmount)
  20. {
  21. this.accountOwner=accountOwner;
  22. this.currentAmount=currentAmount;
  23. this.id=idSeed++;
  24. }
  25.  
  26. SITE METODI VO EDEN INTERFEJS SE UBLIC
  27.  
  28. DODAVANJE NA NOV ACCOUNT VO NIZA SE PRAVI::::
  29. private Account[] accounts;
  30. private int totalAccounts;
  31. private int maxAccounts;
  32.  
  33. public Bank(int maxAccounts) {
  34. this.maxAccounts = maxAccounts;
  35. this.accounts = new Account[maxAccounts];
  36. this.totalAccounts = 0;
  37. }
  38.  
  39. public void addAccount(Account account)
  40. {
  41. accounts[totalAccounts++]=account;
  42. }
  43.  
  44. STARIOT POKAZUVAC POMESTI GO NA NOVO MESTO DA POKAZUVA SO NOVA/DUPLA MMEMORIJA, NA LEVO E STARA GOLEMINA DESNO E NOVA GOLEMINA
  45. accounts=Arrays.copyOf(accounts,maxAccounts*2);
  46. maxAccounts*=2;
  47. STARIOT POKAZUVAC NA accounts ZAMENI GO SO NOV SO POGOLEMA MEMORIJA
  48.  
  49.  
  50. ZA DALI NESTO IMPLEMENTIRA INTERFEJS SE PROFESOVERUVA SO instanceof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement