Computer Science, asked by Anonymous, 1 month ago

wrong answers will be reported...!!!
( please answer quickly..!!)
using InputStreamReader...!! ​

Attachments:

Answers

Answered by kamalrajatjoshi94
6

Answer:

//Program Using InputStream

import java.io.*;

public class Main

{

public static void main(String args[])throws IOException

{

InputStreamReader read=new InputStreamReader(System.in);

BufferedReader in=new BufferedReader(read);

int w,bill=0;

String name;

char ch;

System.out.println("Enter the name of the customer");

name=in.readLine();

System.out.println("Enter the weight of the parcel");

w=Integer.parseInt(in.readLine());

System.out.println("Enter 'O' for Ordinary Booking");

System.out.println("Enter 'E 'for Express Booking");

System.out.println("Enter your choice");

ch=(char)(in.read());

switch(ch)

{

case 'O':

if(w<=100)

bill=80;

else if(w>100&&w<=500)

bill=150;

else if(w>500&&w<=1000)

bill=210;

else if(w>1000)

bill=250;

System.out.println("The entered type is Ordinary Booking");

System.out.println("Name of the customer="+name);

System.out.println("Weight of the parcel="+w+"gm");

System.out.println("Price of the parcel=₹"+bill);

break;

case 'E':

if(w<=100)

bill=100;

else if(w>100&&w<=500)

bill=200;

else if(w>500&&w<=1000)

bill=250;

else if(w>1000)

bill=300;

System.out.println("The entered type is Express Booking");

System.out.println("Name of the customer="+name);

System.out.println("Weight of the parcel="+w+"gm");

System.out.println("Price of the parcel=₹"+bill);

break;

default:

System.out.println("Invalid choice");

}

}

Output is attached

  • As the weight was 500 gm so it displayed ₹150 according to the condition and ordinary booking.
  • As the weight was 750 gm so it displayed ₹250 according to the condition and express booking.
Attachments:
Answered by xXStarQueenXx
1

Hello ishuhk Kafi mahangi ho rahi hai Huh

Similar questions