Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / mcr-test / src / edu / tamu / aser / rvtest / account / Account.java
diff --git a/JMCR-Stable/mcr-test/src/edu/tamu/aser/rvtest/account/Account.java b/JMCR-Stable/mcr-test/src/edu/tamu/aser/rvtest/account/Account.java
new file mode 100644 (file)
index 0000000..87e1e15
--- /dev/null
@@ -0,0 +1,37 @@
+package edu.tamu.aser.rvtest.account;
+
+public class Account {
+    double amount;
+    String name;
+
+    public Account(String nm, double amnt) {
+        amount = amnt;
+        name = nm;
+    }
+
+    // functions
+    //synchronized 
+    void depsite(double money) {
+        amount += money;
+    }
+
+     synchronized 
+     void withdraw(double money) {
+        amount -= money;
+    }
+     
+synchronized    
+void transfer(Account ac, double mn) {
+        amount -= mn;
+        synchronized (ac) 
+        {
+               ac.amount += mn; // now yes. no acquire for the other lock!!
+               }
+            
+    }
+
+    public void print() {
+        // TODO Auto-generated method stub
+    }
+
+}
\ No newline at end of file