Write a program to calculate the cost of the book and discount it by 10% 📚
import java.util.*;
public class bookstore {
long bn; int cost; String name ; double amount;
void input()
{
Scanner sc = new Scanner (System.in);
System.out.println("ENTER YOUR NAME ");
name =sc.nextLine();
System.out.println("ENTER THE BOOK NUMBER ");
bn=sc.nextLong();
System.out.println("ENTER THE COST ");
cost=sc.nextInt();
}
void compute()
{
amount = cost-(cost*0.1);
}
void display()
{
System.out.println("BILL : ");
System.out.println("NAME\t booknumber\tAmount" );
System.out.println(name+"\t"+ bn + "\t"+ amount);
}
public static void main(String[]args)
{
bookstore ob = new bookstore();
ob.input();
ob.compute();
ob.display();
}
}
FOR CODE : CLICK >> https://onecompiler.com/java/3ygpvbmbm TO FIND OUTPUT
SUPPORT US >> https://onethoughttechnology.blogspot.com (OFFICIAL WEBSITE)