nd customer code (either R for residential, C for commercial) for each row. For residential customers: If the KWH is less than or equal to 100 multiply it by 1.50; if the KWH is more than 100 but less than or equal to 200 multiply it by 2.00; for more than 200 KWH multiply it by 2.50. For commercial customers: if the KWH is less than or equal to 100 multiply it by 3.00; If the KWH is more than 100 but less than or equal to 200, multiply it by 4.00; for more than 200 KWH multiply it by 5.00. Display in a window the following information: meter number, customer code, previous meter reading, present meter reading, the kilowatt-hour used or KWH, and the amount to be paid. If no match is found in the 2d-ArrayList, add a new element the meter number, and the meter reading to the 2d-ArrayList. Note: You must put i
Write a Java program that would resemble a power utility billing system. There will be an input window that would enter or input the meter number (5 numeric digits) and the present meter reading in kilowatt-hours, the maximum would be 9999 kilowatts. A search from a 2d-ArrayList would be made in order to get the previous meter reading of a particular meter number. The 2d- ArrayList consists of meter number (5 numeric digits) and the previous meter reading in kilowatt-hours (4 numeric digits with 9999 as a maximum value). Provide at least 5 sample data or 5 rows with meter numbers and previous meter reading for each row for the 2d-ArrayList. When an input of meter number and present meter reading is made, search the 2d-ArrayList for the equivalent meter number. If a match is found, get the kilowatt-hour used (KWH) by subtracting the previous meter reading from the present meter reading. Note that if the present meter reading is less than the previous meter reading, add 10000 first to the present meter reading before subtracting the previous meter reading. To compute the amount to be paid, check first if the customer is residential or commercial. This checking is to be done through another 2d-ArrayList which contains the meter number and the customer code. Provide also at least 5 test data or 5 rows with meter numbers (must be the same as the meter numbers of the previous 2d-ArrayList) and customer code (either R for residential, C for commercial) for each row. For residential customers: If the KWH is less than or equal to 100 multiply it by 1.50; if the KWH is more than 100 but less than or equal to 200 multiply it by 2.00; for more than 200 KWH multiply it by 2.50. For commercial customers: if the KWH is less than or equal to 100 multiply it by 3.00; If the KWH is more than 100 but less than or equal to 200, multiply it by 4.00; for more than 200 KWH multiply it by 5.00. Display in a window the following information: meter number, customer code, previous meter reading, present meter reading, the kilowatt-hour used or KWH, and the amount to be paid. If no match is found in the 2d-ArrayList, add a new element the meter number, and the meter reading to the 2d-ArrayList. Note: You must put initial values in the 2d-array lists required in this program, at least 10 test data for each 2d-ArrayList. Before exiting the program replace the previous meter reading in the 2d-ArrayList with the present meter reading in preparation for the next billing period. Show also the updated 2d-ArrayList by displaying the elements. (USE OOP CONCEPT JFRAME)
Step by step
Solved in 2 steps