Question: I'm having problems getting this Java code to work. Posting broken code after assignment. Can anyone help? Program Instructions: Create a program that calculates a
I'm having problems getting this Java code to work. Posting broken code after assignment. Can anyone help?
Program Instructions: Create a program that calculates a customer's monthly cable bill. The cable service is divided into 3 different subscription types. Each subscription has access to Movies-On-Deman-HD which charges $7.00 per movie. Assume taxes are already in the cost of the service and the movies.





![and the movies. cable.java ---------------->>>>>>>>>>>>>> import java.util.*; class Cable{ private Invoice cableBills[];](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4ef0031338_99966f4eeffaaa6a.jpg)
![private Scanner sc; private Calender dateTime; private String[] billingStmt; public Cable(){ }](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4ef00bdfc1_00066f4ef005e749.jpg)
cable.java ---------------->>>>>>>>>>>>>>
import java.util.*;
class Cable{ private Invoice cableBills[]; private Scanner sc; private Calender dateTime; private String[] billingStmt;
public Cable(){
}
public void start(){ char answer; System.out.println("Do you want to begin processing cable bills? Enter 'Y' or 'N' "); sc = new Scanner(System.in); answer = sc.nextChar(); if(answer == 'Y' || answer == 'y'){ processBill(); displayBill(); displayThanks(); } else{ displayThanks(); } }
public void processBill(){ int num; System.out.println("How many bills are there to process ? "); num = sc.nextInt(); cableBills = new Invoice[num]; billingStmt = new String[num];
for(int i = 1;i
public void displayBill(){ dateTime = Calender.getInstance(); for(int i =0;i System.out.println(dateTime.get(Calender.MONTH)+"/"+dateTime.get(Calender.DATE)+"/"+dateTime.get(Calender.YEAR)); System.out.println(billingStmt[i]); } } public void displayThanks(){ System.out.println("Thank you for being a valued SA CABLE customer "); } } invoice.java : ------------------>>>>>>>>>>>>>> import java.util.Scanner; class Invoice{ private Scanner sc; private String name; private int cablePkg; private int movieOnDemand; private int cbleSrv; public Invoice(){ name = " "; sc = new Scanner(System.in); cablePkg = 0; movieOnDemand = 0; cbleSrv = 0; } public Invoice(String nm){ name = nm; } public void setCustName(int n){ System.out.println("WELCOME TO SA CABLE ") System.out.println("Please enter customer "+n+"'s name : "); name = sc.next(); } public void setCablePkg(int n){ System.out.println("SA CABLE - SUBSCRIPTION PACKAGE - INCLUDES INTERNET SERVICES"); System.out.println("1. BASIC : Local & Major TV network channels $"+35.00); System.out.println("2. Delux : Local , Major TV, Cable and 100 other channels $"+75.00); System.out.println("3. Premium : Delux package plus HBO, on-demand & 300 other channels $"+110.00); System.out.println("select the cable subscription package for customer"+n+" : "); while(1){ cablePkg = sc.nextInt(); if(cablePkg 0){ break; } else{ System.out.println("Please choose between 1 - 3 "); } } } public void determineCableSRV(int n){ switch(n){ case 1: cbleSrv = 35;break; case 2: cbleSrv = 75;break; case 3: cbleSrv = 110;break; default: System.out.println("Cable service not processed because of invalid input "); } } public setMoviePurchased(int n){ System.out.println("SA CABLE - MOVIES"); System.out.println("Enter the number of Movies-On-Demand-HD purchase for customer "+n+" :"); while(1){ movieOnDemand = sc.nextInt(); if(movieOnDemand > 0){ break; } else{ System.out.println("Movie no. is not 0 or negative "); } } } public String getName(){ return name; } public int getCablePkg(){ return cablePkg; } public int getCableSRV(){ return cbleSrv; } public int getMovieNumber(){ return movieOnDemand; } } main.java : ------------------>>>>>>>>>>>> class CableStart{ public static void main(String[] args) { Cable c; c.start(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
