Lab 16
Lab 16
DpaLab 16
Requirements:
● Create a Java project named StudentId_Lab16
● Read instructions and create classes needed.
● All instance variables are private. Please use public methods to access private instance variables.
Description:
In the accounting field, there are many methods for calculating the depreciation (折舊)of fixed assets.
Now, you have to develop a system for calculating depreciation and the book value (帳面價值) of fixed
assets. The company currently only has two major assets, Machine and Vehicle, and they use double
declining balance depreciation method (雙倍餘額遞減法)and straight-line method (直線折舊)to
depreciate, respectively.
1
Programming Language II 111-2
* You should have all the methods below, but you can add anything you want.
Instance variable
Methods
Abstract methods
Instance variable
Methods
Instance variable
Methods
3
Programming Language II 111-2
Otherwise:
depreciation = residual Value * depreciation Rate
4
Programming Language II 111-2
Tester code below has set up the frame, two fixed assets, and all the components in GUI.
You have to implement the other things below:
Submission: Submit your project as “.zip file” via Moodle. No other submissions will be graded.
Reminder: Please zip the whole project
Deadline: Tomorrow’s midnight (for both Mon56 and Tue23)
5
Programming Language II 111-2
class Lab16
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
frame.setTitle(company.getName());
6
Programming Language II 111-2
button1.addActionListener(new LastListener());
button2.addActionListener(new NextListener());
frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}