diff --git a/.vscode/launch.json b/.vscode/launch.json index 991d31d..04c4a81 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,5 +1,19 @@ { "configurations": [ + { + "type": "java", + "name": "Launch GUI2", + "request": "launch", + "mainClass": "GUI.GUI2", + "projectName": "Lab15_OOP_90898795" + }, + { + "type": "java", + "name": "Launch GarageManager", + "request": "launch", + "mainClass": "BillGUI.GarageManager", + "projectName": "Lab15_OOP_90898795" + }, { "type": "java", "name": "Launch GUI1", diff --git a/bill.txt b/bill.txt new file mode 100644 index 0000000..5f2debd --- /dev/null +++ b/bill.txt @@ -0,0 +1,17 @@ +************************* +* Super Auto 20000 bill **** +******************************* + +- Tire replacement 50 +- Tire replacement 50 +- Tire replacement 50 +- Tire replacement 50 +- Battery replacement 320 +- Brake revision 400 +- Oil level control 20 + +---------------------------------- + Bill total 940 +---------------------------------- + +Payment in 30 days. Thank you ! \ No newline at end of file diff --git a/bin/BillGUI/ManagerGui.class b/bin/BillGUI/ManagerGui.class new file mode 100644 index 0000000..295fc32 Binary files /dev/null and b/bin/BillGUI/ManagerGui.class differ diff --git a/bin/GUI/ButtonListener.class b/bin/GUI/ButtonListener.class index 20094e9..5ea8d2d 100644 Binary files a/bin/GUI/ButtonListener.class and b/bin/GUI/ButtonListener.class differ diff --git a/bin/GUI/GUI1.class b/bin/GUI/GUI1.class index 960e727..24dff36 100644 Binary files a/bin/GUI/GUI1.class and b/bin/GUI/GUI1.class differ diff --git a/bin/GUI/GUI2.class b/bin/GUI/GUI2.class index 2e298c9..02a0620 100644 Binary files a/bin/GUI/GUI2.class and b/bin/GUI/GUI2.class differ diff --git a/bin/GUI/Listener.class b/bin/GUI/Listener.class new file mode 100644 index 0000000..feb560b Binary files /dev/null and b/bin/GUI/Listener.class differ diff --git a/bin/bank/BankAccount.class b/bin/bank/BankAccount.class index 97add34..afd2757 100644 Binary files a/bin/bank/BankAccount.class and b/bin/bank/BankAccount.class differ diff --git a/bin/bank/Checking.class b/bin/bank/Checking.class index f745778..f2f8059 100644 Binary files a/bin/bank/Checking.class and b/bin/bank/Checking.class differ diff --git a/bin/bank/Savings.class b/bin/bank/Savings.class index 2f9c7b3..03048f2 100644 Binary files a/bin/bank/Savings.class and b/bin/bank/Savings.class differ diff --git a/src/BillGUI/ManagerGui.java b/src/BillGUI/ManagerGui.java new file mode 100644 index 0000000..f3bfcc2 --- /dev/null +++ b/src/BillGUI/ManagerGui.java @@ -0,0 +1,10 @@ +package BillGUI; + +import javax.swing.JFrame; + +/** + * + */ +public class ManagerGui extends JFrame{ + +} diff --git a/src/GUI/GUI1.java b/src/GUI/GUI1.java index a484750..ddf099f 100644 --- a/src/GUI/GUI1.java +++ b/src/GUI/GUI1.java @@ -2,7 +2,6 @@ package GUI; import javax.swing.*; -import java.awt.AWTEvent; import java.awt.Color; import java.awt.FlowLayout; import java.awt.event.ActionEvent; @@ -10,9 +9,7 @@ import java.awt.event.ActionListener; public class GUI1 extends JFrame { public static void main(String[] args) { - GUI1 f1 = new GUI1(); - - + new GUI1(); } GUI1(){ diff --git a/src/GUI/GUI2.java b/src/GUI/GUI2.java index 818ff5f..6dba5c8 100644 --- a/src/GUI/GUI2.java +++ b/src/GUI/GUI2.java @@ -1,10 +1,80 @@ package GUI; -public class GUI2 { +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.Container; + +/** + * + */ +public class GUI2 extends JFrame{ + int number; public static void main(String[] args) { - + new GUI2(); + } + + /** + * + */ + GUI2(){ + setSize(200,200); + setLocation(600,200); + Container c = this.getContentPane(); + BoxLayout fl = new BoxLayout(c, BoxLayout.Y_AXIS); + c.setLayout(fl); + + JSlider js1 = new JSlider(0, 100); + js1.setValue(0); + JProgressBar jp1 = new JProgressBar(0, 100); + JLabel jl1 = new JLabel("waiting"); + + Listener l = new Listener(jp1, jl1, js1); + js1.addChangeListener(l); + + c.add(js1); + c.add(jp1); + c.add(jl1); + + this.setVisible(true); } - } + +/** + * + */ +class Listener implements ChangeListener { + JProgressBar jp1; + JLabel jl1; + JSlider js1; + + int number = 0; + + /** + * + * @param jp1 + * @param jl1 + * @param js1 + */ + Listener(JProgressBar jp1, JLabel jl1, JSlider js1){ + this.jp1 = jp1; + this.jl1 = jl1; + this.js1 = js1; + } + + /** + * + * @param e + */ + @Override + public void stateChanged(ChangeEvent e) { + number = js1.getValue(); + jl1.setText("" + number); + jp1.setValue(number); + + } + +} + diff --git a/src/bank/BankAccount.java b/src/bank/BankAccount.java index c914dc8..0b8d81f 100644 --- a/src/bank/BankAccount.java +++ b/src/bank/BankAccount.java @@ -1,12 +1,25 @@ package bank; +/** + * Create a bank account with a balance and a owner + */ public abstract class BankAccount { protected double balance; protected String owner; + /** + * Get balance of the account + * @return the balance of the account + */ public double getBalance() { return balance; } + + /** + * Deposit an amount on your account + * Check the amount for accept only positive amount. + * @param amount + */ public void deposit(double amount){ if(amount<0){ error("cannot deposit this amount !"); @@ -14,6 +27,13 @@ public abstract class BankAccount { } balance += amount; } + + /** + * Withdraw an amount on your account + * Check the amount for be sure you have this money + * @param amount The amount you want to withdraw + * @return true : if the withdraw has been done + */ public boolean withdraw(double amount){ if(balance0){ error("Min balance can't be positive"); @@ -27,10 +42,18 @@ public class Checking extends BankAccount{ } this.minBalance = minBalance; } + + /** + * + * @return + */ public double getMinBalance() { return minBalance; } + /** + * + */ @Override public boolean withdraw(double amount){ if((balance-minBalance)