2023 COSC 1436 EL Centro Week 15 Cell Phone Class | Assignment Collections
Computer Science 2023 Java
2023 COSC 1436 EL Centro Week 15 Cell Phone Class | Assignment Collections
/**
* 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.
We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.