Question: use java code Create a class CellPhone that keeps track of cellphones unique identifiers. The class has the following attributes: 1. Variables 1. tag -

 use java code Create a class CellPhone that keeps track of

use java code

Create a class CellPhone that keeps track of cellphones unique identifiers. The class has the following attributes: 1. Variables 1. tag - a static integer that begins at 1 and changes each time an instance is created 2. imei - a string that is unique for each instance of this class 3. Brand - Brand of the phone 4. Model - Which model device it is 2. Create a constructor that sets the name to "IMEI" concatenated with the value of tag. After setting the name, this constructor changes the value of tag by calling the method changeTag. This ensures that every device gets a unique IMEI value to identify it based on the tag. This will also set the brand and model of the phone 3. it has the following methods: 1. Setters for brand and model 2. Getters for all variables 3. writeOutput to print information for a device 4. isPrime(n) a private static method that returns true if n is prime. 1. To check if it is prime, check if it is divisible by any numbers between 2 and n1. 5. changeTag - a private static method that replaces tag with the next prime number larger than the value of tag. (You can use a loop that utilizes isPrime to find the next prime number) 4. Create a driver program. In this you will create 5 phones. 1. Create an array for these devices and save the phones into the array 2. Using a foreach loop, call the writeoutput method for each device

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!