import [Link].
*;
import [Link].*;
public class D2H {
public static void main(String[] args)throws Exception {
AccountDetails obj1=new AccountDetails();
BufferedReader br =new BufferedReader(new
InputStreamReader([Link]));
[Link]("Welcome to SatTV");
int option=0;
do {
[Link]("\n1 . View Account Balance and Current
Subscription");
[Link]("2 . Recharge Account");
[Link]("3 . View Available packs and Channels");
[Link]("4 . Subscribe to base pack");
[Link]("5 . Add channels to an existing
subscription");
[Link]("6 . Update mail and phone number for
notification");
[Link]("7 . Exit");
option = [Link]([Link]());
switch(option) {
case 1:
[Link]();
break;
case 2:
[Link]("Enter the amount to Recharge :");
int amount=[Link]([Link]());
[Link](amount);
break;
case 3:
[Link]();
break;
case 4:
[Link]("Enter the Pack you wish to Subscribe :(
Silver :'S' ,Gold: 'G')");
char choice =[Link]().charAt(0);
[Link]("\nEnter the months : ");
int duration =[Link]([Link]());
[Link](choice,duration);
break;
case 5:
[Link]("\nEnter channel names to
add:Discovery ,Nat Geo ");
String s=[Link]();
[Link](s);
break;
case 6:
[Link]();
break;
}
}while(option != 7);
}
}
class AccountDetails{
int accountBalance;
String name;
long phone;
String currentSubscription;
static HashMap<String,Integer> channelDetails=new
HashMap<String,Integer>();
static {
[Link]("Zee", 10);
[Link]("Sony", 15);
[Link]("Discovery", 10);
[Link]("Nat Geo",20);
[Link]("Star Plus", 20);
}
public AccountDetails() {
[Link]=100;
[Link]="Not Subscribed";
}
public void recharge(int rec) {
if(rec>0) {
[Link]+=rec;
[Link]("Recharge Completed Successfully . Current
balance is "+[Link]);
}
}
public void packs() {
[Link]("Available Packs for subscription\n");
[Link]("Silver pack: Zee ,Sony ,Star Plus : 50Rs ");
[Link]("Gold Pack : Zee , Sony ,Star plus,
Discovery,NatGeo : 100Rs\n");
[Link]("Available Channels for Subscription\n");
[Link]("Zee : 10Rs,Sony: 15Rs, Star plus: 20Rs,Discovery:
10Rs,NatGeo: 20Rs");
}
public void showDetails() {
[Link]("Account Balance : "+[Link]);
[Link]("Current Subscription :
"+[Link]);
}
public void subscribe(char choice,int duration) {
int price=0;
int discount=0,r=0;
if(choice=='G') {
r=100;
[Link]="Gold";
if(duration >=3) {
price=r*duration;
discount=price*10/100;
price=price-discount;
[Link] -=price;
}
else {
price=duration*r;
[Link]-=price;
}
}
else if(choice == 'S') {
r=50;
[Link]="Silver";
if(duration >=3) {
price=r*duration;
discount=price*10/100;
price=price-discount;
[Link] -=price;
}
else {
price=duration*r;
[Link]-=price;
}
}
[Link]("You have Successfully Subscribed the following
pack-"+[Link]);
[Link]("Monthly Price : "+r);
[Link]("No of Months : "+duration);
[Link]("Subscription Amount : "+r*duration);
[Link]("Discount applied : "+discount);
[Link]("Final Price after discount : "+price);
[Link]("Email notification send successfully ");
[Link]("SMS notification sent Successfully");
}
public void addChannel(String channelNames) {
// [Link]("Enter channel names to add (Separated by commas):");
String channels[]=[Link](",");
int totalPrice=0;
for(int i=0;i<[Link];i++) {
String ch=channels[i].trim();
int p=[Link](ch);
totalPrice+=p;
}
if(totalPrice > [Link]) {
[Link]("Insufficient Balance");
}
else {
[Link] -= totalPrice;
[Link]("Channel Added Successfully");
}
[Link]("Account Balance :"+[Link]);
}
public void updateDetails() throws Exception {
[Link]("Update email and number for notifications");
BufferedReader br =new BufferedReader(new
InputStreamReader([Link]));
[Link]("Enter the email : ");
String name=[Link]();
[Link]=name;
[Link]("Enter phone :");
long num=[Link]([Link]());
[Link]=num;
[Link]("\nEmail and Phone Updated Successfully ");
}
}