Computer Science, asked by deeptineelayavalasa, 9 months ago

write a java program to accept ‘M’or ‘F’ and price of a product.if gender is M discount on product is 10% else it is 20%

Answers

Answered by aditi5144
1

Answer:

import java.util.scanner

class discount

{

public static void main (string args[])

{

long disc;

long amt;

Scanner SC= new scanner( system.in);

sopln("enter M if male

enter F if female");

string s= SC.nextLine();

if( s=M)

{

long disc= 0.10*amt;

}

else

{

long disc =0.20*amt;

}

sopln(" You entered "+s" your discount is "+disc);

}

}

Similar questions