Package Model
Enum Class ServiceType
- All Implemented Interfaces:
Serializable
,Comparable<ServiceType>
,Constable
The `ServiceType` enum represents various types of utility services, each with its associated unit charges and service charges.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionELECTRICITY service type.GAS service type.WATER service type. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprivate
ServiceType
(double unitCharges, double serviceCharges) Constructs a `ServiceType` with the specified unit charges and service charges. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the service charges for this service type.double
Get the unit charges for this service type.void
setServiceCharges
(double serviceCharges) Set the service charges for this service type.void
setUnitCharges
(double unitCharges) Set the unit charges for this service type.static ServiceType
Returns the enum constant of this class with the specified name.static ServiceType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ELECTRICITY
ELECTRICITY service type. Unit Charges: $0.12 per unit Service Charges: $10.0 -
GAS
GAS service type. Unit Charges: $0.08 per unit Service Charges: $15.0 -
WATER
WATER service type. Unit Charges: $0.05 per unit Service Charges: $20.0
-
-
Field Details
-
unitCharges
private double unitCharges -
serviceCharges
private double serviceCharges
-
-
Constructor Details
-
ServiceType
private ServiceType(double unitCharges, double serviceCharges) Constructs a `ServiceType` with the specified unit charges and service charges.- Parameters:
unitCharges
- The unit charges for the service type.serviceCharges
- The service charges for the service type.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getUnitCharges
public double getUnitCharges()Get the unit charges for this service type.- Returns:
- The unit charges.
-
setUnitCharges
public void setUnitCharges(double unitCharges) Set the unit charges for this service type.- Parameters:
unitCharges
- The unit charges to set.
-
getServiceCharges
public double getServiceCharges()Get the service charges for this service type.- Returns:
- The service charges.
-
setServiceCharges
public void setServiceCharges(double serviceCharges) Set the service charges for this service type.- Parameters:
serviceCharges
- The service charges to set.
-