Computer Science, asked by shalini683, 1 year ago

Using scanner class method

it is a java program



Please answer it correctly

I will mark you as brainlist

Please answer it very fast

Attachments:

Answers

Answered by Anonymous
3

CODE :


import java.util.*;


class Prepaid_taxi


{


public static void main(String args[])


{


Scanner sc=new Scanner(System.in);


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


int d=sc.nextInt();


System.out.println("Enter the TAXI number");


int n=sc.nextInt();


int c=0;


if(d<=5)


{


c=d*100;


}


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


{


c=(5*100)+(15-d)*10;


}


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


{


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


}


else


{


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


}


System.out.println("Taxi No: "+n);


System.out.println("Distance travelled : "+d);


System.out.println("Charges :"+c);


}


}



IMPORTANT THINGS TO NOTE :


➡ When the distance travelled is upto 5 , then the money will be ( distance × 100 ).


➡ If distance is more than 5 , the money will be the previous charge of ( 100 × 5 ) and the remaining distance that is (15-d )× 10.


➡ The more the distance , the previous charges get added up.


➡ This kind of programs are called Dependence Slabs .



EXAMPLE :

Distance = 40


Charge = ( 5×100 ) + ( 10×10 ) + ( 10×8 ) + (d-25)×5


= > 500 + 100 + 80 + ( 40 - 25 )×5


= > 680 + 15×5


= > 680 + 75


= > 755


shalini683: wrong
Anonymous: which part ?
Answered by KatiLMehbooba
1

wassup dude...

Insert two nails on the wooden or rubber cork and place them on a beaker as shown in figure. Connect iron nail to a bulb, 6 volt battery and a wire connected to switch. Pour some alcohol or glucose so as to dip the nails in glucose or alcohol. Turn the switch on and you the see the bulb not glowing despite of connection to switch. Now empty the beaker and add HCL solution. This time bulb glows. This proves acid can conduct electricity but alcohol and glucose does not conduct electricity.

Similar questions