Computer Science, asked by jaeguri, 6 months ago

2)create a class Mall and define a function Billing( ) to input details of a product as, product code (pc) long integer type, quantity (qty) and price of product (pr) in decimals. calculate the total cost of the product, 15.5% discount on total cost and net price to be paid after the discount. print all the details of the product.

note:
-use java
-donot spam or you will be reported
-solve and get 5 stars and brainliest​

Answers

Answered by imtiyazallam
9

Answer:

import java.util.*;

public class Mall {

   public void billing() {

       //var declaration

       long pc;

       double qty, pr, tc, netP;

       Scanner sc = new Scanner(System.in);

       //input

       System.out.print("Enter the product code: ");

       pc = sc.nextLong();

       System.out.print("Enter the Quantity: ");

       qty = sc.nextDouble();

       System.out.print("Enter the price of product: ");

       pr = sc.nextDouble();

       //processing

       tc = qty * pr;

       netP = 15.5 / 100 * tc;

       //output

       System.out.println("\nProduct code:       " + pc);

       System.out.println("Price of 1 product: " + pr);

       System.out.println("Quantity purchased: " + qty );

       System.out.println("Total cost:         " + tc);

       System.out.println("Discount given:     15.5%");

       System.out.println("Net price:          " + netP);

   }

   public static void main(String args[]) {

       Mall m = new Mall();

       m.billing();

   }

}

Answered by trisha5247
2

Answer:

import java.util.*;

public class Mall {

public void billing() {

//var declaration

long pc;

double qty, pr, tc, netP;

Scanner sc = new Scanner(System.in);

//input

System.out.print("Enter the product code: ");

pc = sc.nextLong();

System.out.print("Enter the Quantity: ");

qty = sc.nextDouble();

System.out.print("Enter the price of product: ");

pr = sc.nextDouble();

//processing

tc = qty * pr;

netP = 15.5 / 100 * tc;

//output

System.out.println("\nProduct code: " + pc);

System.out.println("Price of 1 product: " + pr);

System.out.println("Quantity purchased: " + qty );

System.out.println("Total cost: " + tc);

System.out.println("Discount given: 15.5%");

System.out.println("Net price: " + netP);

}

public static void main(String args[]) {

Mall m = new Mall();

m.billing();

}

}

Similar questions