a. The telephone department wishes to compute monthly telephone bills for its customers using the following slabs/rules on the basis of calls made:
Number of calls Rate
First 80 calls Rs. 2.50 per call
Next 80 calls 60 paisa/call
Next 160 calls 50 paisa/call
Any call above 280 calls 40 paisa/call
Write a program to input no. of calls and compute total bill amount print the output including the no. of calls consumed, and the bill amount to be paid.
(9th computer java)
Answers
Answer:
import java.util.*;
class Telephonebill
{
public static void main()
{
Scanner Sc=new Scanner(System.in); System.out.println(“Enter no of calls made ”);
double c=Sc.nextDouble();double a=0;
if(c>=80)
{
a=2.50*c;
} else if(c>=80&&c<=160)
{
a=(80*2.50)+((c-180*0.60);
}
else if(c>=160&&c<=280)
{
a=(80*2.50)+(80*0.60)+(( c-160)*0.50);
}
else if(a>=280)
{
a=(80*2.50)+(80*0.60)+(120*0.50)+((c-280)*0.40;
}
{
System.out.println(“Total number of calls made is “+c);
}
{
System.out.println(“Bill amount is “+a);
} } }
Output: Enter the no. of calls made 200
Total number of calls made is 200
Bill amount is 264
Explanation:
mark as brainliest
import java.util.*;
class Telephonebill {
public static void main() {
Scanner Sc=new Scanner(System.in);
System.out.println("Enter no of calls made ");
double c = Sc.nextDouble(); double a=0.0;
if(c<=80)
a=2.50*c;
else if(c>=80 && c<=160)
a=(80 * 2.50 )+((c-80)*0.60);
else if( c>=160 && c<=280)
a=(80*2.50)+(80*0.60)+((c-160)*0.50);
else if(a>=280)
a=(80*2.50)+(80*0.60)+(120*0.50)+((c-280)*0.40);
System.out.println("Total number of calls made is "+c);
System.out.println("Bill amount is "+a);
} }
previous answer is wrong don't folllow it pls mine is correct