Program this with JAVA only with arrays, inheritance, polymorphism, exception, interfaces, and abstract classes.

You have the following products data file:

1,name1,desc1,100,50,50,D
2,name2,desc2,50,12,W
3,name3,desc3,30,20,W
4,name4,desc4,80,60,55,D

-------------- For each record, the following data are common:
product id, product name, product description, product price

For records that end with D (Dimensional), the two values before the D letter are product width and length.
For records that end with W (Weighted), the value before the W letter represents the product weight.

------------ Create an abstract class named Product which contains the following attributes:
product id, product name, product description, product price, and calcPay() abstract method.

Create a subclass from the Product class to represents the Dimensional Product, add the following attributes:
width and length. Implements the calcPay() so that it returns the result of (width * length * price).

Create another subclass from the Product class to represents the Weighted Product, add the following attribute:
weight. Implements the calcPay() so that it returns the result of (weight * price).

------------- When the program run, the following choices appear:

1- Show All Products
2- Add Product
3- Delete Product
4- Edit Product
5- Calculate Total Price
6- Save data to file
7- Exit Enter your choice:

--------------- Notes

1- Read the data from the file and store it in an array of type Products.
2- Add, Edit, and Delete operations changing the data in the array and when you choose the 6th choice (Save data to file), the changes are stored to the file.
3- Calculate Total Price (the 5th choice), sums the result of calling calcPay() from each object in the array.

Program this with java language only with arrays, inheritance, polymorphism, exception, interfaces, and abstract classes.

Solved
Programming in Java 1 Answer Anonymous(s) Post