Skip to content

Conversation

@amira921
Copy link
Owner

Before reviewing task 1, please check the README file first.

@@ -0,0 +1,36 @@
public class Account {
private long accountNumber;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the maximum range of Long ?
what if I have number of accounts greater than the max size of long ?
so , use String instead and search for the above questions :)

@@ -0,0 +1,30 @@
import java.util.ArrayList;
public class Bank {
ArrayList<SavingsAccount>accounts = new ArrayList<>();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the initialization of this array list should be inside the constructor

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did but when I tried to add a new saving account as an employee and then tried login as a customer with this account number, it failed.

@@ -0,0 +1,11 @@
public class SavingsAccount extends Account {
private double interestRate = 0.05; // assume the interest rate = %5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must be final as it's constant

@@ -0,0 +1,16 @@
import java.util.Hashtable;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accepted solution. try to solve it using two pointers technique

@@ -0,0 +1,15 @@
import java.util.Hashtable;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the more memory optimized solution will be using frequency array so try to solve it using it

@amira921 amira921 requested a review from EngAhmedSalah August 12, 2023 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants