import [Link].
*;
import [Link].*;
import [Link].*;
public class fileread{
public static void main(String []args)throws IOException{
Scanner scnr = new Scanner([Link]);
DecimalFormat dcfm = new DecimalFormat("###,###.00");
Date date = new Date();
String DATE_FORMAT = "MM/dd/yyyy";
SimpleDateFormat sidf = new
SimpleDateFormat(DATE_FORMAT);
String strDateFormat = "HH:mm:ss";
SimpleDateFormat sdf = new
SimpleDateFormat(strDateFormat);
//>>Variables
String productID = "";
String data="";
String answer="";
String product[];
int check=0;
String str="",Discount="";
String strQuanTT="";
int QuanTT=0;
int counter=0;
double VAT=0, less=0;
double amount=0;
double Dproduct=0;
double PWD=0;
double PWD15=0;
double Senior=0, Suki=0,Senior20=0, Suki10=0;
double payment=0;
double amountDue=0;
double change=0;
FileInputStream fis = new FileInputStream
("Productinfo_.txt");
DataInputStream dis = new DataInputStream(fis);
BufferedReader br = new BufferedReader
(new InputStreamReader(dis));
[Link]
("********************************************");
while(true){
[Link]("Enter Product ID : ");
productID = [Link]();
while((data = [Link]())!=null){
product = [Link](", ");
if([Link](product[0])){
[Link]("Product name: " + product[1]);
[Link]("Unit price: " + product[2]);
check = 1;
[Link]("Enter quantity: ");
strQuanTT = [Link]();
QuanTT = [Link](strQuanTT);
Dproduct = [Link](product[2]);
amount = amount + (Dproduct*QuanTT);
counter = counter + QuanTT;
str = str +product[1]+"\t\t"+product[2]+"\t\t"+QuanTT+ "\t\
t"+[Link](amount)+"\n";
}
}
if(check == 0){
[Link]("Records Not Found!!!");}
check = 0;
[Link]().position(0);
[Link]
("Do yuo want to buy another Product? [ Yes/No ]: ");
answer = [Link]();
if([Link]("No")){
[Link]("The Program Will Terminate\n");
[Link]
("********************************************");
[Link]("\nDate : " + [Link](date)+"\t\t\t");
[Link]("Time : " + [Link](date));
[Link]("Description");
[Link]. println
("_________________________________________");
[Link]("Prodoct"+"\t\t"+"Price"+"\t\t"+
"Quantity"+"\t"+"Total cost");
[Link](str);
[Link]. println
("_________________________________________");
[Link]("products bought: "+counter+"\n");
[Link]("\n°°°[ 1 ]None \n°°°[ 2 ] Senior Sitizen \n°°°[ 2 ] PWD \
n°°°[ 1 ] Suki card\n");
[Link]("\nSelect Type of Discount: ");
Discount = [Link]();
VAT = amount*0.12;
less = amount-VAT;
[Link]("VAT: "+[Link](VAT)
+"\t\t\t\t\t\t"+"["+[Link](amount)+"]");
[Link]("Less Vat: "+[Link](less));
//--->> Discount
if ([Link] ("1")){
[Link]
("Type of Discount: None ");}
else if ([Link] ("2")){
[Link]
("Type of Discount: Senior Sitizen");}
else if ([Link] ("3")){
[Link]
("Type of Discount: PWD");}
else {
[Link]
("Type of Discoun:t Suki card: ");}
if ([Link] ("1")){
[Link]
("Discount amount: ");}
else if ([Link] ("2")){
Senior = amount+VAT;
Senior20 = Senior*0.20;
[Link]
("Discount amount: "+[Link](Senior20));}
else if ([Link] ("3")){
PWD = amount+VAT;
PWD15 = PWD*0.15;
[Link]
("Discount amount: "+[Link](PWD15));}
else {
Suki = amount+VAT;
Suki10 = Suki*0.10;
[Link]
("Discount amount: "+[Link](Suki10));}
[Link]("\n");
//--->> Amount Due
if ([Link] ("1")){
amountDue = amount+VAT;
[Link]
("Amount due: "+[Link](amountDue));}
else if ([Link] ("2")){
amountDue = Senior-Senior20;
[Link]
("Amount due: "+[Link](amountDue));}
else if ([Link] ("3")){
amountDue = PWD-PWD15;
[Link]
("Amount due: "+[Link](amountDue));}
else {
amountDue = Suki-Suki10;
[Link]
("Amount due: "+[Link](amountDue));}
do {
[Link]("Payment: Php ");
payment = [Link]();
if (payment < amountDue){
[Link]("your payment is insufficient 💸 🚫");}
} while(payment< amountDue);
{
{
change = (payment-amountDue);
if ([Link] ("1")){
[Link]("Change: Php "+[Link](change));}
else if ([Link] ("2")){
[Link]("Change: Php "+[Link](change));}
else if ([Link] ("3")){
[Link]("Change: Php "+[Link](change));}
else {
[Link]("Change: Php "+[Link](change));}
[Link](0);
}
}
}
}
}
}