-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeleCall.java
More file actions
47 lines (46 loc) · 1.33 KB
/
TeleCall.java
File metadata and controls
47 lines (46 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.*;
public class TeleCall
{
long phone;
String name;
int n;
double amt;
TeleCall(long p,String nm,int num)
{
name=nm;
phone=p;
amt=0;
n=num;
}
void Compute()
{
if(n>=1 && n<=100)
amt=500;
if(n>=101 && n<=201)
amt=500+((n-100)*1);
if(n>=201 && n<=300)
amt=500+100+((n-200)*1.20);
if(n>300)
amt=500+100+(100*1.20)+((n-300)*1.50);
}
void Display()
{ System.out.println("\n-----------------------------------------------");
System.out.println("\n\t\tYOUR BILL:");
System.out.println("\n\tCustomer Name:"+name+"\n\tPhone Number:"+phone+"\n\tBill(Rs):"+amt);
System.out.println("\n-----------------------------------------------");
}
public static void main(String[] args)
{
Scanner as=new Scanner(System.in);
System.out.println("\tTelecomunication Bill Generator\n");
System.out.print("Enter your Name:");
String N=as.nextLine();
System.out.print("Enter your Phone Number:");
long PhNO=as.nextLong();
System.out.print("Enter The Number of Times you Made A Calls:");
int Call=as.nextInt();
TeleCall as1=new TeleCall(PhNO,N,Call);
as1.Compute();
as1.Display();
}
}