សាកលវ ិទ្យាល័យភូមិន្ភ
ទ ំពន េញ Java Programming
មហាវ ិទ្យយល័យវ ិស្វកមម ពោកគ្រូ៖ ពោ ស្ុខជា
ឆ្នទ្យ
ំ ី២ ឆមាស្ទ្យី១ Lab4
LAB 4: ITECalculator
If you have completed lab 1 to 3, your calculator already contains a lot of methods to
perform arithmetic, basic trigonometric, and bitwise methods. In this lab, you will continue
your calculator application by adding the following features:
A. Create a new class named it StorageConverter. The StorageConverter class will
consist of wide ranges of methods to perform conversion.
B. Please add Javadoc comment to above the class to explain the purpose of this
class and above each method to explain it.
C. In the StorageConverter class, please create the following methods:
1. byte2KB(long numByte) to convert from byte to kilobyte
2. byte2MB(long numByte) to convert from byte to megabyte
3. byte2GB(long numByte) to convert from byte to gigabyte
4. byte2TB(long numByte) to convert from byte to terabyte
5. byte2PB(long numByte) to convert from byte to petabyte
6. kb2Byte(long kilobyte) to convert from kilobyte to byte
7. kb2MB(long kilobyte) to convert from kilobyte to megabyte
8. kb2GB(long kilobyte) to convert from kilobyte to gigabyte
9. kb2TB(long kilobyte) to convert from kilobyte to terabyte
10. kb2PB(long kilobyte) to convert from kilobyte to petabyte
សាកលវ ិទ្យាល័យភូមិន្ភ
ទ ំពន េញ Java Programming
មហាវ ិទ្យយល័យវ ិស្វកមម ពោកគ្រូ៖ ពោ ស្ុខជា
ឆ្នទ្យ
ំ ី២ ឆមាស្ទ្យី១ Lab4
11. mb2Byte(long megabyte) to convert from megabyte to byte
12. mb2KB(long megabyte) to convert from megabyte to kilobyte
13. mb2GB(long megabyte) to convert from megabyte to gigabyte
14. mb2TB(long megabyte) to convert from megabyte to terabyte
15. mb2PB(long megabyte) to convert from megabyte to petabyte
16. gb2Byte(long gigabyte) to convert from gigabyte to byte
17. gb2KB(long gigabyte) to convert from gigabyte to kilobyte
18. gb2MB(long gigabyte) to convert from gigabyte to megabyte
19. gb2TB(long gigabyte) to convert from gigabyte to terabyte
20. gb2PB(long gigabyte) to convert from gigabyte to petabyte
21. tb2Byte(long terabyte) to convert from terabyte to byte
22. tb2KB(long terabyte) to convert from terabyte to kilobyte
23. tb2MB(long terabyte) to convert from terabyte to megabyte
24. tb2GB(long terabyte) to convert from terabyte to gigabyte
25. tb2PB(long terabyte) to convert from terabyte to petabyte
26. pb2Byte(long petabyte) to convert from petabyte to byte
27. pb2KB(long petabyte) to convert from petabyte to kilobyte
28. pb2MB(long petabyte) to convert from petabyte to megabyte
សាកលវ ិទ្យាល័យភូមិន្ភ
ទ ំពន េញ Java Programming
មហាវ ិទ្យយល័យវ ិស្វកមម ពោកគ្រូ៖ ពោ ស្ុខជា
ឆ្នទ្យ
ំ ី២ ឆមាស្ទ្យី១ Lab4
29. pb2GB(long petabyte) to convert from petabyte to gigabyte
30. pb2TB(long petabyte) to convert from petabyte to terabyte
D. Please add fourth menu item Storage Converter to the menu
E. When user chooses menu number 5, it wills show a submenu containing the
following menu
1. Byte
Byte to Kilobyte
Byte to Megabyte
Byte to Gigabyte
Byte to Terabyte
Byte to Petabyte
2. Kilobyte
Kilobyte to byte
Kilobyte to Megabyte
Kilobyte to Gigabyte
Kilobyte to Terabyte
Kilobyte to Petabyte
3. Megabyte
Megabyte to byte
Megabyte to Kilobyte
Megabyte to Gigabyte
Megabyte to Terabyte
Megabyte to Petabyte
សាកលវ ិទ្យាល័យភូមិន្ភ
ទ ំពន េញ Java Programming
មហាវ ិទ្យយល័យវ ិស្វកមម ពោកគ្រូ៖ ពោ ស្ុខជា
ឆ្នទ្យ
ំ ី២ ឆមាស្ទ្យី១ Lab4
4. Gigabyte
Gigabyte to byte
Gigabyte to Kilobyte
Gigabyte to Megabyte
Gigabyte to Terabyte
Gigabyte to Petabyte
5. Terabyte
Terabyte to byte
Terabyte to Kilobyte
Terabyte to Megabyte
Terabyte to Gigabyte
Terabyte to Petabyte
6. Petabyte
Petabyte to byte
Petabyte to Kilobyte
Petabyte to Megabyte
Petabyte to Gigabyte
Petabyte to Terabyte
សាកលវ ិទ្យាល័យភូមិន្ភ
ទ ំពន េញ Java Programming
មហាវ ិទ្យយល័យវ ិស្វកមម ពោកគ្រូ៖ ពោ ស្ុខជា
ឆ្នទ្យ
ំ ី២ ឆមាស្ទ្យី១ Lab4
Note:
No Unit Description
1 Kilobyte (KB) 1 KB = 1024 Bytes
2 Megabyte (MB) 1 MB = 1024 KB
3 Gigabyte (GB) 1 GB = 1024 MB
4 Terabyte (TB) 1 TB = 1024 MB
5 Petabyte (PB) 1 PB = 1024 TB