-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathBankAccount.java
30 lines (29 loc) · 980 Bytes
/
BankAccount.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
public class BankAccount {
public static void main(String[] args){
double balance = 1000.75;
double amountToWithdraw = 250;
/*
create a new double variable called
updatedBalance, and store balance
with amountToWithdraw subtracted
from it.
*/
double updatedBalance = balance - amountToWithdraw;
/*
Create a double variable called
amountForEachFriend that holds
your updated balance divided by 3.
*/
double amountForEachFriend = updatedBalance / 3;
/*
Create a boolean called canPurchaseTicket and
set it equal to whether or not amountForEachFriend
is at least enough to purchase a $250 concert
ticket.
*/
boolean canPurchaseTicket = amountForEachFriend >= 250;
// print canPurchaseTicket
System.out.println(canPurchaseTicket);
System.out.println("I gave each friend " + amountForEachFriend + "...");
}
}