Computer Science, asked by sumitabhakat220, 11 months ago

WAP in Java that accepts from the user the number of letters from the telegram and calculate the telegram charge as per the following table :
The table is given in the attachment above . Please answer it everyone. It's urgent .​

Attachments:

Answers

Answered by sherlock611holmes
2

Answer:

import java.util.*;

class telegram

{

public static void main()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter the no. of telegrams ");

int n=sc.nextInt();              //inputting

double charge =0;

if(n<=10)                             //computation

charge=25;

else if(n<=50)

charge = 25+(n-10)*1;

else

charge=65+(n-50)*2;

System.out.println("Charge on the telegram = "+charge +" p.");

}

}

PLEASE MARK AS BRAINLIEST.

Similar questions