Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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.");


}

}

}


Explanation / Answer

Hope this will be helpful import java.util.*; import java.io.*; public class CableCompanyBilling { static Scanner console = new Scanner(System.in); //Named constants - residential customers 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; //Named constants - business customers 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.00; public static void main(String[] args) { //Variable declaration int accountNumber; char customerType; int noOfPremChannels; int noOfBasicServConn; double amountDue; System.out.println("This program computes " + "a cable bill."); System.out.print("Enter the account " + "number: "); //Step 1 accountNumber = console.nextInt(); //Step 2 System.out.println(); System.out.print("Enter the customer type: " + "R or r (Residential), " + "B or b(Business): "); //Step 3 customerType = console.next().charAt(0); System.out.print("Enter the number of " + "premium channels: "); noOfPremChannels = console.nextInt(); System.out.println(); System.out.println("Account number = " + accountNumber); if (customerType == 'R' || customerType == 'r') { amountDue = residentcust(); } else if (customerType == 'B' || customerType == 'b'){ amountDue = businesscust(); } System.out.printf("Amount due = $%.2f %n", amountDue); } public static double residentcust() { int noOfPremChannels; double amountDue; int accountNumber; amountDue = R_BILL_PROC_FEE + //Step 5c R_BASIC_SERV_COST + noOfPremChannels * R_COST_PREM_CHANNEL; return amountDue; } public static double businesscust() { int noOfPremChannels; double amountDue; int accountNumber; int noOfBasicServConn; if (noOfBasicServConn
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote