Write a java program to input the telephone and number of calls. Calculate and display the bill amount, which include fixed rent of Rs.400.The first 150 calls are free with excess calls are changed at 80 paise each.
class PhoneBill
{
public static void main(String args[])
{
int phno=Integer.parseInt(args[0]);
int nocall=Integer.parseInt(args[1]);
int bill=400;
if(nocall>150)
System.out.println("The Bill Amount is= "+(bill+((nocall-150)*.80)));
else
System.out.println("The Bill Amount is="+bill);
}
}
output:
D:\JavaPrograms\CmdPrograms>javac PhoneBill.java
D:\JavaPrograms\CmdPrograms>java PhoneBill 23544 200
The Bill Amount is= 440.0
D:\JavaPrograms\CmdPrograms>java PhoneBill 52088 100
The Bill Amount is=400
0 Comments
Post a Comment