-
Notifications
You must be signed in to change notification settings - Fork 0
Week3 Tasks added #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Task 1-Bank System/src/Account.java
Outdated
| @@ -0,0 +1,36 @@ | |||
| public class Account { | |||
| private long accountNumber; | |||
There was a problem hiding this comment.
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 :)
Task 1-Bank System/src/Bank.java
Outdated
| @@ -0,0 +1,30 @@ | |||
| import java.util.ArrayList; | |||
| public class Bank { | |||
| ArrayList<SavingsAccount>accounts = new ArrayList<>(); | |||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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
Task 2-problem solving/Two Sum.java
Outdated
| @@ -0,0 +1,16 @@ | |||
| import java.util.Hashtable; | |||
There was a problem hiding this comment.
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; | |||
There was a problem hiding this comment.
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
Before reviewing task 1, please check the README file first.