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.

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. cable.java ---------------->>>>>>>>>>>>>> import java.util.*; class Cable{ private Invoice cableBills[];

private Scanner sc; private Calender dateTime; private String[] billingStmt; public Cable(){ }

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(); } }

Cost and Description $35.00 a month for local channels, major TV networks, and Internet service $75.00 a month for local channels, major TV networks, major cable networks, and 100 channels plus Internet service $110.00 a month for Deluxe services, on-demand services, plus 300 more channels to include HBO plus Internet service Service Basic Deluxe Premium 1. Develop your code by planning the logic FIRSI You will only pseudocode the plan for the Invoice class. a. There is an example of a PA4 plan on Blackboard. Use that to assist with your plan. b. The prompts (to return press Alt then left arrow) tell you what input variables you will need c. The will tell you the type of calculations you will need (if any) and whether you will need to declare additional variables d. The sample output will tell you the order of logic for your code e. Save your plan as GroupMembersLastNamesSecNoPA4Plan. Download the plan instructions and the plan template through the links posted for this assignment on Blackboard 2. Download the Creating Projects in DrJava PDF (instructor's version) on how to create a project folder that manages multiple .java files stored in the same folder. The project folder has the same name as the group .java file. You are creating 3 separate .java files to be stored in the project folder: a. TeamMembersLastNames SectionNoPANo.java contains only the main0) i. The main) wil instantiate (create) an object of the Cable class and use that object to call start(). Make sure you exit main(). b. Cable.java c. Invoice.java 3. The fields/class variables are non-static. All methods are non-static except for the main). The non-static methods do not have the word static" in their headers. 4. The Cable class will have 4 methods: an empty constructor, start), processBills) and displayBills0, and printThankYou(). You will create a 1D array called cableBills at the class level as a null array. The type for this array will be Invoice. This class has 4 fields: cableBills array, Scanner input, Calendar dateTime, and another array of type String called billingStmts a. Code an empty constructor b. start) contains a local variable called answer that holds the response to the first prompt in the sample output. Based on that response, processBills( and displayBills) are called or a "Thank you message is printed c. In processBills), the user will be prompted for the number of bills. That number gives size to the cableBills and billingStmts arrays. The cableBils array will then be populated with information for multiple bills; movieCharges and a total consisting of movieCharges and cableSrv are calculated; and the billingStmts array will be populated with the invoice/bill for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!