Java Program for shop Bill to Calculate total amount of product with discount
Java Program for shop Bill to print total amount with discount
To print total amount with discount
import java.util.Scanner;
class Shop
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the product name and its price.");
String a=sc.next();
double r1=sc.nextDouble();
System.out.println("Enter the 2nd product name and its price.");
String b=sc.next();
double r2=sc.nextDouble();
System.out.println("Enter the 3rd product name and its price.");
String c=sc.next();
double r3=sc.nextDouble();
double d1=r1-(r1*0.08);
double d2=r2-(r2*0.08);
double d3=r3-(r3*0.08);
System.out.println("Product Price DiscountPrice");
System.out.println("-----------------------------");
System.out.println(" "+a+" "+r1+" "+d1);
System.out.println(" "+b+" "+r2+" "+d2);
System.out.println(" "+c+" "+r3+" "+d3);
System.out.println("-----------------------------");
System.out.println("Total"+" "+(d1+d2+d3));
}
}
great java tips At SynergisticIT we offer the best java course training in california
ReplyDelete