Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

More Books

Students also viewed these Databases questions

Question

5. It is the needs of the individual that are important.

Answered: 1 week ago