Computer Science, asked by harsh19647047, 11 months ago

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 :)
harsh19647047: I am new ,I don't know how to mark as brainliest...
harsh19647047: may u tell me
rakeshchennupati143: down at my answer you will see a mark called "brainliest" jus click it thats it

Answers

Answered by harsh7828
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);

}

}


harsh19647047: thanks yrrr
rakeshchennupati143: string args should have [] braces
harsh19647047: okkkk baba
rakeshchennupati143: and that whole progrm is wrong
rakeshchennupati143: there is no input class imported to take input
rakeshchennupati143: and where is the value of b given to print?
Answered by rakeshchennupati143
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.   :)


harsh19647047: is this one correct and verified..
rakeshchennupati143: it is correct program i compiled and checked output twice
Similar questions