import com.almworks.sqlite4java.*;
import java.io.*;

public class COFFEE1 
{
public static void main(String arg[]) throws SQLiteException
{
SQLiteConnection db = new SQLiteConnection(new File("temp"));
db.open(true);
db.exec("drop table if exists COFFEE1");
db.exec("create table COFFEE1(NAME String, CODE int, PRICE double, AMOUNT int,TOTAL double)");
db.exec("insert into COFFEE1 values('espresso',150,9.99,110,0);");
db.exec("insert into COFFEE1 values('Venezuella',173,12.99,57,0);");
db.exec("insert into COFFEE1 values('Brasilian',123,11.56,39,0);");
db.exec("insert into COFFEE1 values('Colombian',111,15.99,20,0);");
db.exec("update COFFEE1 set TOTAL=PRICE*AMOUNT;");
SQLiteStatement statement = db.prepare("select * from COFFEE1");
String NAME;
int CODE;
double PRICE;
int AMOUNT;
double TOTAL;
try {
      while (statement.step()) {
	    int ii=statement.getBindParameterIndex("NAME"); 
        NAME=statement.columnString(0);
        CODE=statement.columnInt(1);
        PRICE=statement.columnDouble(2);
        AMOUNT=statement.columnInt(3);
        TOTAL=statement.columnDouble(4);
        System.out.println("ii = " + NAME);
        System.out.print("COFFEE NAME = " + NAME);
        System.out.print(" CODE = " + CODE);
        System.out.print(" PRICE = " + PRICE);
        System.out.print(" AMOUNT = " + AMOUNT);
        System.out.println(" TOTAL = " + TOTAL);
      }
    } finally {
      statement.dispose();
    }
}}
