Java Reference
In-Depth Information
customerType = console.next().charAt(0);
//Step 4
System.out.println();
switch (customerType)
{
case 'r':
//Step 5
case 'R':
System.out.print("Enter the number of "
+ "premium channels: ");
//Step 5a
noOfPremChannels = console.nextInt();
//Step 5b
System.out.println();
amountDue = R_BILL_PROC_FEE +
//Step 5c
R_BASIC_SERV_COST +
noOfPremChannels *
R_COST_PREM_CHANNEL;
System.out.println("Account number = "
+ accountNumber); //Step 5d
System.out.printf("Amount due = $%.2f %n",
amountDue);
//Step 5e
break ;
case 'b':
//Step 6
case 'B':
System.out.print("Enter the number of "
+ "basic service "
+ "connections: ");
//Step 6a
noOfBasicServConn = console.nextInt();
//Step 6b
System.out.println();
System.out.print("Enter the number of "
+ "premium channels: ");
//Step 6c
noOfPremChannels = console.nextInt();
//Step 6d
System.out.println();
if (noOfBasicServConn <= 10)
//Step 6e
amountDue = B_BILL_PROC_FEE +
B_BASIC_SERV_COST +
noOfPremChannels *
B_COST_PREM_CHANNEL;
else
amountDue = B_BILL_PROC_FEE +
B_BASIC_SERV_COST +
(noOfBasicServConn - 10) *
B_BASIC_CONN_COST +
noOfPremChannels *
B_COST_PREM_CHANNEL;
System.out.println("Account number = "
+ accountNumber);
//Step 6f
 
Search WWH ::




Custom Search