in java
Lab 3 Objective and Overview: This lab exercise is an exercise on Objects and classes, attributes, methods, accessors, mutators, and toString() method. This lab covers CLO#3 Problem 1: An electronics Shop wants to keep track of its inventory. It needs to save information about each cell phone it has. For each cell phone, it needs to know its brand, production year, memory size, number of cameras and price. 1. Create a Java class "CellPhone" that has the following attributes: (brand, production year, memory size, number of cameras and price). Give all attributes a suitable type and a private visibility. 2. Write two constructors for the class CellPhone: one without parameters, and another with parameters to fill all its attributes. 3. Write an accessor and a mutator method for each attribute. Make all methods public. 4. Write a "toString()" method to display the attributes of the class "Cellphone" Testing: 5. Create a new Java Main class "TestElectronics" to test your "Cell Phone" class. The class should have a main method to do the following: a. Create an object of type "CellPhone" using the constructor without parameters b. Set the brand of the cell phone to "Android", production year to "2020", memory size to 200, number of cameras to 3, and price to 2500.00 using the mutator methods. c. Display the cell phone object using the toString() method. d. Create another object of type "Cellphone" using the constructor with parameters, setting the and give it appropriate values using the initialization constructor. e. Display the cell phone using the toString() method. f. Open a file called "electronics.txt" that has all the information about the available cell phones in the store. The file will look like this: Android 2020 400 3450.00 2019 360 3 2350.00 Huawei 2020 380 2 2280.50 Android 2019 350 2380.00 Then the main method should read the information about each cell phone from the input file, create an object of type "Cellphone" and initialize its attributes, then display this object using the toString() method. 3 Apple 2 & Find and print the average price for all cellphones in the file. h. Find and print the number of cell phones that has 3 or more cameras. iii. Problem 2 1. A supermarket is selling some items. It needs to know the profit it is making after selling each day. Help the supermarket owner by building an application to do that. Create a class named "Item" which has the following fields. i. Item number : String ii. Number of items sold: int purchase price : double iv. selling Price : double 2. Write two constructors for the class Item: one without parameters, and another with parameters to fill all its attributes 3. Write an accessor and a mutator method for each attribute. Make all methods public. 4. Write a "toString()" method to display the attributes of the class "item" Testing: 1. Write a Java program "TestSupermarket". In the main method, open the file ItemInventory.txt and read the information about each item: ABC1234 35.5 40.5 XYZ5434 30 200 230 WQE767 250 100 TRY1290 100 25 30 2. For each item, an instance of the class "Item" is created and the profit (or loss) is calculated. 3. Write each instance created to an output file, "Items.out" using a Print Writer Java class. Write the profit or loss beside each item. 4. At the end, write the total profit or loss for the supermarket on this day. 20 90 Have fun