Java Methods Design and Implementation

 /* This method will add the particular package to the DTHService  only if the package   is not present in the DTHService and return true. Otherwise return  false */

+findChannel(int channelId) throws ChannelNotFoundException:Channel


 /* This method will check  if the particular channel is present  in the  existing list of packages in the DTHServices and   if found ,then  need to  return channel details  .Otherwise need to throw an exception- ChannelNotFoundException in the below format “The given channel is not found”

+tagChannelToPackage(Package p,Channel c):String


 /* This method will add the given  channel to the given  package  only if the  totalChannels tagged to that package is less than 5.And hence return “The channel ---- is  tagged to the package....”/.
Otherwise display the message like “The channel cannot be tagged ”

+findChannelRating(float rating):ArrayList<Channel>


 /* This method will return all the channels whose rating is greater than the given rating and the ownerId is divisble by 2*/

+calculateTotalCost(Package p):double


  1.  For the Special Package :->totalCost will be the total cost of the channels tagged to the package-additional rate
  2.  For the Normal Package :->totalCost will be the total cost of the channels tagged to the package-discount


Optional Methods

+findMaxChannelCost():double

 /*This method will  find the maximum cost of the channel present in the DTHServices */

Get Project Solution Now

Comments