Question
JAVA code: import java.util.Scanner; import java.util.Date; import java.util.Calendar; import java.text.*; class myclass { public static void main(String args[]) { int cablePkg,noOfMovies,totalMovieCharges=0; int cableSrv=0,a=0,b=0,c=0,a1=0,b1=0,c1=0,TOTAL=0; String cableSub=;
JAVA code:
import java.util.Scanner; import java.util.Date; import java.util.Calendar; import java.text.*;
class myclass {
public static void main(String args[]) {
int cablePkg,noOfMovies,totalMovieCharges=0; int cableSrv=0,a=0,b=0,c=0,a1=0,b1=0,c1=0,TOTAL=0; String cableSub=""; char repeat='Y';
Date date = Calendar.getInstance().getTime(); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy"); while(repeat=='Y') {
System.out.println("WELCOME TO SA CABLE "); System.out.println("Please enter your name:"); Scanner in=new Scanner(System.in); String customerName=in.nextLine(); char toContinue='Y';
do {
System.out.println("SA CABLE - SUBSCRIPTION PACKAGES "); System.out.println("1.Basic: Local & major TV network channels $35"); System.out.println("2.Deluxe:Local, major TV, cable & 100 other channels $75"); System.out.println("3.Premium: Deluxe package plus HBO, on-demand & 300 other channels $110"); System.out.println(" Select your cable subscription package:"); cablePkg=in.nextInt();
if(cablePkg 3){
do {
System.out.println("Invalid!"); System.out.print("Choose 1, 2 or 3."); cablePkg=in.nextInt(); }
while(cablePkg 3); }
System.out.println("SA CABLE-MOVIES "); System.out.println("Enter the number of Movies-On-Demand-HD purchases:");
switch (cablePkg) {
case 1: cableSrv = 35; a1=noOfMovies=in.nextInt();
a=totalMovieCharges=noOfMovies*7+cableSrv; cableSub="Basic"; break;
case 2: cableSrv = 75; b1=noOfMovies=in.nextInt();
b=totalMovieCharges=noOfMovies*7+cableSrv; cableSub="Deluxe"; break;
case 3: cableSrv = 110; c1=noOfMovies=in.nextInt();
c=totalMovieCharges=noOfMovies*7+cableSrv; cableSub="Premium"; break; }
System.out.println("SA CABLE CHARGES AS OF "+sdf.format(date)); System.out.println("Customer:"+customerName.toUpperCase()+" "); System.out.println("Cable Service:"+" "+"$"+cableSrv); System.out.println("Cable Subscription type: " +cableSub); System.out.println("Movie-On-Demand-HD: "+" "+"$"+totalMovieCharges); System.out.println("TOTAL DUE:"+" "+"$"+(cableSrv+totalMovieCharges)); System.out.println(" Thank you for being a valued SA Cable customer!");
System.out.println(" Enter 'Y' to continue with another subscription for the same customer or 'N' to exit:");
toContinue=in.next().charAt(0); }
while(toContinue=='Y');
System.out.println("SA CABLE CHARGES AS OF "+sdf.format(date)); System.out.println("Customer:"+customerName.toUpperCase()+" "); if(a!=0) { System.out.println("Cable Service:"+" "+"$ 35"); System.out.println("Cable Subscription type: Basic"); System.out.println("Movie-On-Demand-HD: "+" "+"$"+a1+" "+a); TOTAL=TOTAL+a+35; }
if(b!=0) { System.out.println("Cable Service:"+" "+"$ 75"); System.out.println("Cable Subscription type: Deluxe"); System.out.println("Movie-On-Demand-HD: "+" "+"$"+b1+" "+b); TOTAL=TOTAL+b+75; }
if(c!=0) { System.out.println("Cable Service:"+" "+"$ 110"); System.out.println("Cable Subscription type: Premium"); System.out.println("Movie-On-Demand-HD: "+" "+"$"+c1+" "+c); TOTAL=TOTAL+c+110; } System.out.println("TOTAL DUE:"+" "+"$"+(a+b+c));
System.out.println(" Thank you for being a valued SA Cable customer!");
System.out.println("Enter 'Y' to continue with another customer or 'N' to exit:"); repeat =in.next().charAt(0); in.close(); }
System.exit(0); }//END main()
}//END APPLICATION
WELCOME TO SA CABLE Please enter your name: Maggie Jones SA CABLE - SUBSCRIPTION PACKAGES-INCLUDES INTERNET SERVICE 1. Basic: Local&major TV network channels 2. Deluxe: Local, major TV, cable & 100 other channels 3. Premium: Deluxe package plus HBO, on-demand&300 other channels 110.00 $ 35.00 75.00 Select your cable subscription package: 1 SA CABLE - MOVIES Enter the number of Movies -On-Demand-HD purchases 0 SA CABLE CHARGES AS OF 10/16/17 Customer MAGGIE JONES Cable Service: Movies-On-Demand-HD 35.00 0.00 35.00 Thank you for being a valued SA Cable customer! Enter 'Y' to continue or 'N' to exit: nStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started