write a program in Java
wap to input the amount on the purchase of the product then calculate the discount is 7% then print the net amount paid by the customer....
guys please reply fast it's very urgent.....
rakeshchennupati143:
if you liked it mark as brainliest i will help me so much :)
Answers
Answered by
2
Explanation:
public class product
{
public static void main(String args);
{
int a;
int d;
int b;
SOPln("enter the price of product"+a);
d = 7÷100×a;
sopln("discount = "+d);
sopln("net amount paid ="+b);
}
}
Answered by
5
Program:
import java.util.*;
public class Discount{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("Enter the Amount of product purchased");
int amount = sc.nextInt();
System.out.println("7% discount on product the amount payable is : "+(amount - (0.07 * amount)))
}
}
Explanation:
- if you want to take input we have to take it using scanner class or buffered reader class
- here i used scanner class to take input because it is easy to implement when compared to buffered reader class-
- initialized scanner with an object called "sc"
- i took purchased amount into "amount" variable of int type
- and in print statement i calculated 7% discount by doing
- amount - (0.07 * amount)
- 0.07 * amount calculates 7% of given amount
- then amount - (0.07 * amount) subtracts 7% amount from the given amount so that we will get amount with a discount of 7%
----Hope this helps you get what you want,if you liked it mark as brainliest,it would really help me. :)
Similar questions