java
/**
* COSC 1436
* EL Centro
* Week 15
* Cell Phone Class
*
* This CLASS does not need to change
*
*/
import java.util.ArrayList;
import java.util.Arrays;
public class CellPhone {
// Attributes
private final ArrayList<String> AVAILABLE_BATTERY_TYPES = new ArrayList<>(
Arrays.asList("NiCd", "NiMH", "Lo-ion", "Li-pol"));
private ArrayList<Long> favoritePhoneNumbers = new ArrayList<Long>();
private String cellProvider = "AT&T";
private String batteryType = null;
private boolean isFlipPhone = false;
private boolean hasInternational = false;
// Methods
public ArrayList<Long> getFavoritePhoneNumbers() {
return favoritePhoneNumbers;
}
public void addAFavoritePhoneNumber(Long phoneNumber) {
this.favoritePhoneNumbers.add(phoneNumber);
}
public void deleteAFavoritePhoneNumber(int phoneNumber) {
this.favoritePhoneNumbers.remove(phoneNumber);
}
public String getCellProvider() {
return cellProvider;
}
public void setCellProvider(String cellProvider) {
this.cellProvider = cellProvider;
}
public String getBatteryType() {
return batteryType;
}
/**
* Validates battery type
* @param batteryType
* @return
*/
public boolean setBatteryType(String batteryType) {
if (AVAILABLE_BATTERY_TYPES.contains(batteryType)) {
this.batteryType = batteryType;
return true;
}
return false;
}
public boolean isFlipPhone() {
return isFlipPhone;
}
public void setFlipPhone(boolean isFlipPhone) {
this.isFlipPhone = isFlipPhone;
}
public boolean isHasInternational() {
return hasInternational;
}
public void setHasInternational(boolean hasInternational) {
this.hasInternational = hasInternational;
}
public ArrayList<String> getAVAILABLE_BATTERY_TYPES() {
return AVAILABLE_BATTERY_TYPES;
}
public boolean isValidBatteryType() {
return batteryType != null;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CellPhone [favoritePhoneNumbers=");
builder.append(favoritePhoneNumbers);
builder.append(", cellProvider=");
builder.append(cellProvider);
builder.append(", batteryType=");
builder.append(batteryType);
builder.append(", isFlipPhone=");
builder.append(isFlipPhone);
builder.append(", hasInternational=");
builder.append(hasInternational);
builder.append(", valid battery type=");
builder.append(isValidBatteryType());
builder.append("]");
return builder.toString();
}
}
Create a new Java Project for this assignment.
Copy the provided class CellPhone into your default package area.
- Create a new class called SmartPhone that extends CellPhone. Add the following attributes:
- boolean - hasGPS.
- boolean - hasWIFI.
- String OSVersion. Default to "Windows 10 Mobile";
- long internalMemoryStorageCapacity - Default to 16_000_000_000L;
- Generate the setters and getters and toString() method.
- Create a new class called TestPhone that includes a main() method.
- Inside the main() method of TestPhone, do the following:
- Create an instance of CellPhone. Set all the following attributes to values of your choosing: (Call all the setters with values)
- cell provider
- isFlipPhone
- hasInternational
- batteryType
- Add 2 favorite phone numbers
- Display the CellPhone toString results.
- Create an instance of SmartPhone. Set the following attributes to values of your choosing:
- hasGPS
- hasWIFI
- OSVersion
- cell Provider
- isFlipPhone
- hasInternational
- batteryType
- Add 1 favorite phone number
- Display the SmartPhone toString results.
- Create an instance of CellPhone. Set all the following attributes to values of your choosing: (Call all the setters with values)
Deliverables include the SmartPhone.java and TestPhone.java files.
There is no defined constructors in the CellPhone class so the super() method does not need to be addressed.
6 years ago
15
Answer(1)![blurred-text]()
![]()
Purchase the answer to view it

NOT RATED
- SmartPhone.java
- TestPhone.java
- VID-20201202-WA0083.mp4
- 2classeswork1.rtf
other Questions(10)
- Identify the sentence, One aspect of history that is rarely studied in school is how people's played
- Nikki G’s Corporation’s 10-year bonds are currently yielding a return of 6.35 percent. The expected inflation premium is 1.05 percent annually and the real interest rate is expected to be 2.70 percent annually over the next ten years. The liquidity risk p
- 192.7 ----- 17.35
- Music
- Recommendations and Strategies for A Small U.S. hotel chain would like to enter into Spain.
- for geniusy_2006 only please
- three
- Geen's Alternations Shop began business as a corporation in 2009. Several transactions which occurred early in 2009 are described below....
- Geometry Homework - High School - about 35 - easy - Must Show work ***Need in 11 hours***
- For you 424690962