Digital services are used throughout Information Technology. Digital Service Providers offer Internet connectivity, streaming movies and music and even computing infrastructure on a pay-as-you go basis.
That is, the customer pays only for what they use. For this assignment, you will individually develop a Digital Service Provisioning Framework (DSPF) in Java. The DSPF comprises Java classes modeling digital service providers and their usage by customers. The Digital Service Provider classes implement functionality for a payment system interface and uses specialized exception classes extending the standard Java Exception classes.
To obtain full marks, you must design the DSPF using OOP design principles e.g. constructors,
encapsulation and provide detailed Javadoc code commenting.
Design a class modelling a Customer’s service provider account. Your class stores the relevant details of the customer, such as their name and contact details which are supplied as input to a constructor.
When a customer account is created, it is assigned a unique number (hint: use a class field to keep track of the number of accounts created). The customer’s name is also modified and stored in uppercase letters. Customer accounts implement the Comparable interface and are ordered
according the name of the Customer.
Digital Service Providers
Design an abstract DigitalServiceProvider class that maintains a record of the customer’s usage of the service. You may consider using a HashMap to map customer accounts to their usage of the service. Your class will provide three methods to update and access the provider’s records:
void subscribe(CustomerAccount,ServiceUsage) adds the customer account and their initial service usage to the provider’s records.
void unsubscribe(CustomerAccount) removes the customer’s account from the
ServiceUsage getUsage(CustomerAccount) return the customer’s service usage
void updateUsage(CustomerAccount,ServiceUsage) updates the customer’s
These methods throw a ServiceException (or an appropriate subclass of) when an exceptional event occurs, such as the customer is not found in the records or is already subscribed.
Select a suitable class to complete the method String customerTranscript(boolean byName)
which outputs a string containing a sorted list of customer names and their service usage on a
separate line. The last line prints the total number of customers. When byName is true, customers
are sorted in ascending order according to their name. Otherwise, customers are sorted according to their usage of the service, in descending order (See the ServiceUsage class below).
Create the concrete subclass CloudProvider of DigitalServiceProvider.
Service Exception Classes
Design a ServiceException class extending Java’s Exception class. An exception contains the
customer account causing the exception, a text description of the error and the time the error
occurred. This can be done by calling System.currentTimeMillis() in the constructor and storing the result in an instance variable. A nice representation of the time is obtained by invoking new
Create subclasses that are appropriate for exceptional events that occur when the service provider’s records are updated. For example, subscribe may throw a CustomerAlreadyExistsException when a customer already existing in the service provider’s records attempts to re-subscribe to the service.
Digital service provider’s store details of each of their customer’s usage of the service. Create an
abstract ServiceUsage class which implements the Comparable interface.
Design a CloudUsage subclass of ServiceUsage containing the cloud customer’s current usage
information: how many virtual machines and virtual disk storage devices the customer is using.
Digital service provider’s bill their customers according to the amount of their service used. Create a PaymentSystem interface which contains a signature for a method to calculate a customer’s Bill given the customer’s account and their service usage.
The DigitalServiceProvider class implements the PaymentSystem interface.
Design a Bill class that stores the customer’s account details, a description of the charges and the
total amount owing.
CloudProvider Bill Payment
Implement the PaymentSystem interface’s method in the CloudProvider class. Here’s an example of a String output by the Bill class toString method:
Customer name: KENNETH JOHNSON. Account Number: 4
Contact details: WT703C WT BUILDING, AUT CITY CAMPUS
1) $1.68 (12 Virtual Machines @ $0.14 each)
2) $3.57 (7 Disk Storage Devices @ $0.51 each)
TOTAL Amount owing: $5.25.
Extending Digital Service Providers
Extend the DigitalServiceProvider class with three more subclasses of Digital Services. You are
required to complete
Three subclasses of DigitalServiceProvider
Three ServiceUsage subclasses, one for each new digital service provider
An implementation of the PaymentSystem interface for each provider with their own
unique bill calculation.
Develop an application class called DigitalServiceProviderSelectionApp which has a main method that interacts with the core functionality of your classes. Your program should involve multiple. Digital Services to select from, the ability for customer’s to subscribe and unsubscribe. Your application should be capable of demonstrating all class functionality. You must catch and handle all exceptions arising from improper console input or exceptions thrown by the service providers