Program

import java.util.Scanner;
import java.text.DecimalFormat;
public class MobileBill {
public static void main(String[]args){
final double lcalls = 0.10;
final double icalls = 1.00;
final double net = 500.00;
double localcalls, ISDcalls, totallocalcalls, totalISDcalls, netbill, totalnetbill,totalbill;
Scanner keyboard = new Scanner(System.in);
DecimalFormat df = new DecimalFormat(“0.00”);
System.out.println(“Please Enter your local calls in minutes: “);
localcalls = keyboard.nextDouble();
System.out.println(“Please Enter your ISD calls in minutes: “);
ISDcalls = keyboard.nextDouble();
System.out.println(“Please Enter your data usuage in gigabytes: “);
netbill = keyboard.nextDouble();

String name;
System.out.println(“Please Enter your name: “);
name = keyboard.next();

totallocalcalls = localcalls * lcalls;
totalISDcalls = ISDcalls * icalls;
totalnetbill = netbill * net;
totalbill = totallocalcalls+totalISDcalls+totalnetbill;

System.out.println(“************************”);
System.out.println(“Hello “+name);
System.out.println(“Your bill is “);
System.out.println(“The total local bill is “+df.format(totallocalcalls));
System.out.println(“The total ISD bill is “+df.format(totalISDcalls));
System.out.println(“The total net bill is “+df.format(totalnetbill));
System.out.println(“The total total bill is “+df.format(totalbill));
System.out.println(“************************”);

}
}

Leave a comment