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

Please code in Java using if else statements and casting. Wireless Data Billing

ID: 3748452 • Letter: P

Question

Please code in Java using if else statements and casting.

Wireless Data Billing AT&P Wireless, sells wireless data to its customers. AT&P has developed a marketing plan to incent customers to purchase or upgrade their services at a time to try to increase sales.

They have created three different subscription packages for its customers.

Package 1: For $60 per month 1GB of shared data internet access are provided. If the customer passes this limit, overage charges will be applied $20 per additional 1GB

Package 2: For $75 per month 3GB of shared data internet access are provided. If the customer passes this limit, overage charges will be applied $15 per additional 1GB

Package 3: For $90 per month 5GB of shared data internet access are provided. If the customer passes this limit, overage charges will be applied $10 per additional 1GB

Note: Customer will be charged for a full GB of additional data, regardless of how much they go over the amount in their package.

For example, customer on “Package 1” who used 1.01GB will be charged for an additional 1 GB Customer will be charged for a full GB of additional data, regardless of how much they go over the amount in their package.

For example, customer on “Package 2” who used 3.01GB will be charged for an additional 1 GB Customer will be charged for a full GB of additional data, regardless of how much they go over the amount in their package.

For example, customer on “Package 3” who used 5.01GB will be charged for an additional 1 GB

Write a program that accepts information from the user and calculates a customer’s monthly bill. It should store the number of the package the customer has purchased (1, 2, 3) and the value of GB that were used. (assume the sales tax rate is 6.5%).

Your program should prompt the user to enter the following information:

Customer name

Customer Plan

Data used during the month

The program then outputs the following information:

Customer’s name

Price Base Plan

Overcharge data in GB

Overcharged Amount

Total Monthly Charges

Sales tax

Total amount due

Explanation / Answer

INPUT

My program takes 3 inputs customer name,customer plan and data used by the customer on a month.

so input name is a string.customer plan is either of these 3 integers 1,2,3 and data used is a float value.

OUTPUT:

print customer name.

print price base plan as per charges for each plan choosen($60 for 1,$75 for 2 .......

find overused data and print it.

Also calculate overcharged amount from overused data and print.

print total monthly charges(base price+overcharge amount)(after doing neccessary calculations).

print sales tax which is fixed:6.5% for each plan.

total due amount:which is bill amount.(bill amount included with sales Tax.

please note these:

1)In case the overcharged data is 3.01,it will be charged for 4GB .

2)Overcharged data will be accurate to decimal places.

3)For example for printing .01 in rare cases it might print out .009999999,since i used double for all for consistency in decimal handling.

4)type casting is used to calculate total units of overcharged data,please look into code under each if case i have used.

My code:

package cheggq1;

import java.util.Scanner;

public class que1 {

public static void main(String args[])

{

Scanner in=new Scanner(System.in);

String name=in.next();

int plan=in.nextInt();

int bp1=60;

int bp2=75;

int bp3=90;

int ap1=20;

int ap2=15;

int ap3=10;

double st=6.5;

double dataused=in.nextDouble();

if(plan==1)

{

double overuseddata= (dataused-1);

int roundoff=(int)overuseddata;

if(roundoff!=overuseddata)

{

roundoff+=1;

}

double monthlycharge=roundoff*ap1+bp1;

double overchargeamount=roundoff*ap1;

double billdue=monthlycharge+(monthlycharge*6.5)/100;

System.out.println(name);

System.out.println(bp1);

System.out.println(overuseddata);

System.out.println(overchargeamount);

System.out.println(monthlycharge);

System.out.println(st);

System.out.println(billdue);

}

else

if(plan==2)

{

double overuseddata= (dataused-3);

int roundoff=(int)overuseddata;

if(roundoff!=overuseddata)

{

roundoff+=1;

}

double monthlycharge=roundoff*ap2+bp2;

double overchargeamount=roundoff*ap2;

double billdue=monthlycharge+(monthlycharge*6.5)/100;

System.out.println(name);

System.out.println(bp2);

System.out.println(overuseddata);

System.out.println(overchargeamount);

System.out.println(monthlycharge);

System.out.println(st);

System.out.println(billdue);

}

else

if(plan==3)

{

double overuseddata= (dataused-5);

int roundoff=(int)overuseddata;

if(roundoff!=overuseddata)

{

roundoff+=1;

}

double monthlycharge=roundoff*ap3+bp3;

double overchargeamount=roundoff*ap3;

double billdue=monthlycharge+(monthlycharge*6.5)/100;

System.out.println(name);

System.out.println(bp3);

System.out.println(overuseddata);

System.out.println(overchargeamount);

System.out.println(monthlycharge);

System.out.println(st);

System.out.println(billdue);

}

}

}