-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mohaned Yossry Abdulaziz
committed
Nov 25, 2020
1 parent
277acce
commit 3bf16b9
Showing
10 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
public class Section5 { | ||
public static void main(String[] args) { | ||
BankAccount myAccount = new BankAccount(100); | ||
myAccount.displayBalance(); | ||
myAccount.deposit(1000); | ||
myAccount.displayBalance(); | ||
myAccount.withdraw(300); | ||
myAccount.displayBalance(); | ||
|
||
} | ||
|
||
} | ||
|
||
class BankAccount { | ||
double balance; | ||
String accountHolder; | ||
long accountNumber; | ||
String password; | ||
|
||
BankAccount(double initialBalance){ | ||
balance = initialBalance; | ||
} | ||
|
||
void withdraw(double amount) { | ||
if (amount > balance) { | ||
System.out.println("Invalid Balance"); | ||
} else { | ||
balance = balance - amount; | ||
} | ||
} | ||
|
||
void deposit(double amount) { | ||
if (amount > 0) { | ||
balance = balance + amount; | ||
} else { | ||
System.out.println("Invalid amount"); | ||
} | ||
} | ||
|
||
void displayBalance() { | ||
System.out.println("Your balance = " + balance); | ||
} | ||
} | ||
|
||
|
||
class Circle { | ||
double radius; | ||
|
||
// | ||
Circle(double initialRadius) { | ||
radius = initialRadius; | ||
|
||
} | ||
|
||
double calculateCircleArea() { | ||
double area = 3.14 * radius * radius; | ||
return area; | ||
} | ||
} | ||
|
||
|
||
class Student { | ||
String name; | ||
int id; | ||
|
||
int age; | ||
boolean gender; | ||
|
||
void breakfast() { | ||
|
||
} | ||
|
||
void study() { | ||
|
||
} | ||
} |