Computer Science, asked by shalini683, 1 year ago

Answer for 9. question

it is java program

Using scanner class method



Please answer it correctly

I will mark you as brainlist

Please answer it very fast


Attachments:

Answers

Answered by ashish55587
3
Answer 9.


I HOPE IT HELP YOU

❤❤❤@Ashish❤❤❤
Attachments:
Answered by neelbhatkar3
3

import java.util.*;

public class taxi

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

int d ,total bill=0;

int taxino;

String name;

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

name=sc.next();

System.out.println("enter the taxi number");

taxino=sc.nextInt();

System.out.println("enter the distance travelled");

d=sc.nextInt();

if(d>0 && d<=5)

totalbill=100;

if(d>5 && d<=15)

totalbill=100+(d-5)*10;

if(d>15 && d<=25)

totalbill=100+(10*10)+(d-15)*8;

if(d>25)

totalbill=100+(10*10)+(8*10)+(d-25)*5;

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

System.out.println("taxi no="+taxino);

System.out.println("distance covered="+d);

System.out.println("total amount="+totalbill);

}

}





shalini683: u need to put opening brackets
neelbhatkar3: I think it is fine if we don't.
Similar questions