Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE SOLVE IT IN JAVA An electronics Shop wants to keep track of its inventory. It needs to save information about each cell phone it
PLEASE SOLVE IT IN JAVA
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, number of cameras and price. - Create a Java class "Mobile" that has the following private attributes: - brand (String). - production year (int). - number of cameras(int). - prince (double). - Write two constructors for the class CellPhone: one without parameters, and another with parameters to fill all its attributes. - Write an accessor and a mutator method for each attribute. Make all methods public. - Write a "toString0" method to return a string that represents the attributes of the class "CellPhone" Testing: - Create a new Java Main class "Test" to test your "Mobile" class. - The class should have a main method to do the following: a. Create an object of type "Mobile" using the constructor without parameters. b. Set the brand of the cell phone to "Samsung S22", production year to " 2022", number of cameras to 4 , and price to 2500.00 using the mutator methods. c. Display the cell phone object using the toString0 method. d. Create another object of type "Mobile" using the constructor with arameters, 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 vailable cell phones in the store. The file will look like this (spcae separated): Samsung 202243450.00 Apple 202142350.00 Huawei 202132280.50 Nokia 202122380.00 g. Then the main method should read the information about each cell phone from the input file, then create an object of type "Mobile" and initialize its attributes, then display this object using the toString ( method. h. Find and print the average price for all cellphones. i. Find and print the number of cell phones that has 3 or more camerasStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started