class A{
byte bitval1 = 3;
byte bitval2 = 4;
static byte sumIt(byte a, byte b){
return a + b;
}
}
class B{
A obj = new A();
byte result = A.sumIt(obj.bitval1,obj.bitval2);
byte c = 2;
byte d = 5;
// c += 4;
//d = d + 4;
}
public class c3p1{
public static void main(String[] args){
}
}
class B{}
class A extends B{};
class c3p2{
public static void main(String[] args){
A obj1 = new B();
B obj2 = new A();
}
}
class c3p3{
int x = 5;
void Joo(){
int y = 7;
y = JooUp();
}
int JooUp(){
return y++;
}
public static void main(String[] args){
c3p3 obj = new c3p3();
obj.Joo();
}
}
class User{
private int accountID,routingNum;
private float balance, lastDepositAmount, lastWithdrawalAmount;
private String[] info = new String[9]; //info(0) = First name, info(1) = middle name,
//info(2) = Last Name, info(3) = Street Address,
//info(4) = State, info(5) = Zip Code, info(6) = Tel
//info(7) = email address, info(8) = Description
private String creationDate,terminationDate;
private String lastDepositDate, lastWithdrawalDate;
static void getBalance(User user){System.out.println(user.balance);}
static void getCreationDate(User user){System.out.println(user.creationDate);}
static void setCreationDate(User user, String date){user.creationDate = date;}
static void setTerminationDate(User user, String date){user.terminationDate = date;}
static void getTerminationDate(User user){System.out.println(user.terminationDate);}
static void setInfo(User user, String... input){
for(int i=0;i//for(int i=0;i }
static void getInfo(User user){
for(int i=0;iSystem.out.println(user.info[i]);
}
}
static void setDeposit(User user, float deposit,String date){user.balance+= deposit;user.lastDepositAmount = deposit;user.lastDepositDate = date;}
static void setWithdrawal(User user,float withdrawal,String date){
if(withdrawal > user.balance){
System.out.println("Withdrawal amount exceeds balance.");
}
else{
user.balance-= withdrawal; user.lastWithdrawalAmount = withdrawal;
user.lastWithdrawalDate = date;
}
}
static void setAccountID(User user, int accountNum){user.accountID = accountNum;}
static void getAccountID(User user){System.out.println(user.accountID);}
static void setRoutingNum(User user, int routing){user.routingNum = routing;}
static void getRoutingNum(User user){System.out.println(user.routingNum);}
static void getLastDeposit(User user){System.out.println("Date of Deposit: "+user.lastDepositDate + " Amount "+ user.lastDepositAmount);}
static void getLastWithdrawal(User user){System.out.println("Date of Withdrawal "+user.lastWithdrawalDate+" Amount "+user.lastWithdrawalAmount);}
}
class c3p4{
public static void main(String[] args){
User user1 = new User();
createAccount();
user1.getBalance(user1);
}
static void createAccount(){
User user1 = new User();
User.setAccountID(user1, 1234567);
User.setRoutingNum(user1, 9872345);
User.setInfo(user1,"John","C","Partridge","123 Liberty Way","VA","24502","555-3456","jcpartri@liberty.edu","This is a new account holder.");
User.setDeposit(user1, 500.00f,"01/01/2010");
User.setCreationDate(user1, "01/01/2010");
}
}