Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SET: 2 An electronics Shop wants to keep track of its inventory. It needs to save information about each cell phone it has. For each

image text in transcribed

SET: 2 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 "toString()" 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 toString() 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 cameras

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions