Rewrite the Cable Company Billing program below so that it uses the following me
ID: 3647544 • Letter: R
Question
Rewrite the Cable Company Billing program below so that it uses the following methods to calculate the billing amount
a. residentialCustomer: this method calculates and returns the billing amount for the residential customer.
b. businessCustomer: This method calculates and returns the bolling amount for the service business customer.
package cableCompanyBilling1;
import java.util.*;
public class CableCompanyBilling1
{
static Scanner console = new Scanner(System.in);
static final double R_BILL_PROC_FEE = 4.50;
static final double R_BASIC_SERV_COST = 20.50;
static final double R_COST_PREM_CHANNEL = 7.50;
static final double B_BILL_PROC_FEE = 15.00;
static final double B_BASIC_SERV_COST = 75.00;
static final double B_BASIC_CONN_COST = 5.00;
static final double B_COST_PREM_CHANNEL = 50.50;
public static void main(String[] args)
{
int accountNumber;
char customerType;
int numberOfPremiumChannels;
int numberOfBasicServiceConnections;
double amountDue;
System.out.println("This program computes a cable bill.");
System.out.print("Enter the account number: ");
accountNumber = console.nextInt();
System.out.println();
System.out.print("Enter the the cutomer type: "
+ "R or r (Residential), "
+ "B or b (Business): ");
customerType = console.next().charAt(0);
System.out.println();
switch( customerType)
{
case 'r':
case 'R': System.out.print("Enter the number of premium channels: ");
numberOfPremiumChannels = console.nextInt();
System.out.println();
amountDue = R_BILL_PROC_FEE + R_BASIC_SERV_COST + numberOfPremiumChannels * R_COST_PREM_CHANNEL;
System.out.println("Account number = " + accountNumber);
System.out.printf("Amount due = $%.2f %n", amountDue);
break;
case 'b':
case 'B': System.out.print("Enter the number of basic " + "service connections: ");
numberOfBasicServiceConnections = console.nextInt();
System.out.println();
System.out.print("Enter the numberm or premium channels: " );
numberOfPremiumChannels = console.nextInt();
if (numberOfBasicServiceConnections <=10)
amountDue = B_BILL_PROC_FEE + B_BASIC_SERV_COST + numberOfPremiumChannels * B_COST_PREM_CHANNEL;
else
amountDue =B_BILL_PROC_FEE + B_BASIC_SERV_COST +(- 10) * B_BASIC_CONN_COST + numberOfPremiumChannels * B_COST_PREM_CHANNEL;
System.out.println("Account number = " + accountNumber);
System.out.printf("Amount due = $%.2f %n", amountDue);
break;
default: System.out.println("Invalid customer type.");
}
}
}