chongkeyface
asked on
one simple bug
there is one simple bug, after selecting the more items 'y'(sales menu), it doesnt aks for the product code anymore.
class bakemenu{
public static void main (String args[])
throws java.io.IOException {
int precheese = 2;
int soldcheese = 0;
double sellcheese = 36.00;
int prechoc = 4;
int soldchoc = 0;
double sellchoc = 30.00;
int prestraw = 2;
int soldstraw = 0;
double sellstraw = 28.00;
int preegg = 20;
int soldegg = 0;
double sellegg = 1.20;
int prepine = 20;
int soldpine = 0;
double sellpine = 1.20;
int prenuts = 100;
int soldnuts = 0;
double sellnuts = 0.80;
int prechips = 100;
int soldchips = 0;
double sellchips = 0.70;
int precheese2 = 2;
int prechoc2 = 4;
int prestraw2 = 2;
int preegg2 = 20;
int prepine2 = 20;
int prenuts2 = 100;
int prechips2 = 100;
String code = new String();
int quantity = 0;
int numberOfBytesToRead = 10;
double total = 0.00;
double totalsum = 0.00;
System.out.println ("\n");
System.out.println ("------------------------ ---------- ---------- ---------- ---------- ---------- -----");
System.out.println (" Famouze Bakery, Madamme Memziers ");
System.out.println ("\n");
System.out.println ("Category Favorite Qty Prepared Qty Sold Selling Price($)); ");
System.out.println ("------------------------ ---------- ---------- ---------- ---------- ---------- -----");
System.out.print ("Cake [c1]Cheese" + " " + precheese + " " +soldcheese + " " +sellcheese);
System.out.print (" [c2]Chocolate" + " " + prechoc + " " +soldchoc + " " +sellchoc);
System.out.println (" [c3]Strawberry" + " " + prestraw + " " +soldstraw + " " +sellstraw);
System.out.println ("\n");
System.out.print ("Pastry [p1]Egg" + " " + preegg + " " +soldegg + " " +sellegg);
System.out.print (" [p2]Pineapple" + " " + prepine + " " +soldpine + " " +sellpine);
System.out.println ("\n");
System.out.print ("Cookie [k1]Pecan and Nuts" + " " + prenuts + " " +soldnuts + " " +sellnuts);
System.out.println (" [k2]Chocolate chips" + " " + prechips + " " +soldchips + " " +sellchips);
System.out.println ("\n");
System.out.println ("------------------------ ---------- ---------- ---------- ---------- ---------- -----");
System.out.println ("[S]ales [D]aily Order [C]ollection E[X]it");
System.out.println ("\n");
//char moreitems = 'y' ;
//char option = 'y' ;
char option;
System.out.print ("Option:" );
option = (char)System.in.read();
System.in.skip(2);
//System.out.println("\n") ;
switch(option){
case 's':{totalsum = 0.00;
char cont = 'y';
do {
System.out.println("Items sold:-");
System.out.println("enter product code:");
byte[] buffer = new byte[numberOfBytesToRead];
int bytesRead = System.in.read(buffer);
byte[] bufferRead = new byte[bytesRead - 2];
System.arraycopy(buffer, 0, bufferRead, 0, bytesRead - 2);
code = new String(bufferRead);
System.out.print("Enter quantity:");
bytesRead = System.in.read(buffer);
bufferRead = new byte[bytesRead - 2];
System.arraycopy(buffer, 0, bufferRead, 0, bytesRead - 2);
quantity = new Integer(new String(bufferRead)).intVal ue();
if ("c1".equals(code))
{ if (quantity > precheese2)
{ System.out.println("not enough stock");}
else{
precheese2 = precheese2 - quantity;
soldcheese = soldcheese + quantity;
total = sellcheese * quantity;
totalsum = totalsum + total;
}
}
if ("c2".equals(code))
{ if (quantity > prechoc2)
{ System.out.println("not enough stock");}
else{
prechoc2 = prechoc2 - quantity;
soldchoc = soldchoc + quantity;
total = sellchoc * quantity;
totalsum = totalsum + total;
}
}
if ("c3".equals(code))
{ if (quantity > prestraw2)
{ System.out.println("not enough stock");}
else{
prestraw2 = prestraw2 - quantity;
soldstraw = soldstraw + quantity;
total = sellstraw * quantity;
totalsum = totalsum + total;
}
}
if ("p1".equals(code))
{ if (quantity > preegg2)
{ System.out.println("not enough stock");}
else{
preegg2 = preegg2 - quantity;
soldegg = soldegg + quantity;
total = sellegg * quantity;
totalsum = totalsum + total;
}
}
if ("p2".equals(code))
{ if (quantity > prepine2)
{ System.out.println("not enough stock");}
else{
prepine2 = prepine2 - quantity;
soldpine = soldpine + quantity;
total = sellpine * quantity;
totalsum = totalsum + total;
}
}
if ("k1".equals(code))
{ if (quantity > prenuts2)
{ System.out.println("not enough stock");}
else{
prenuts2 = prenuts2 - quantity;
soldnuts = soldnuts + quantity;
total = sellnuts * quantity;
totalsum = totalsum + total;
}
}
if ("k2".equals(code))
{ if (quantity > prechips2)
{ System.out.println("not enough stock");}
else{
prechips2 = prechips2 - quantity;
soldchips = soldchips + quantity;
total = sellchips * quantity;
totalsum = totalsum + total;
}
}
System.out.println("More Items(y/n) ?");
cont = (char) System.in.read();
}while (cont != 'n');
System.out.println("Total amount due =" +totalsum);
}
}
}
}
class bakemenu{
public static void main (String args[])
throws java.io.IOException {
int precheese = 2;
int soldcheese = 0;
double sellcheese = 36.00;
int prechoc = 4;
int soldchoc = 0;
double sellchoc = 30.00;
int prestraw = 2;
int soldstraw = 0;
double sellstraw = 28.00;
int preegg = 20;
int soldegg = 0;
double sellegg = 1.20;
int prepine = 20;
int soldpine = 0;
double sellpine = 1.20;
int prenuts = 100;
int soldnuts = 0;
double sellnuts = 0.80;
int prechips = 100;
int soldchips = 0;
double sellchips = 0.70;
int precheese2 = 2;
int prechoc2 = 4;
int prestraw2 = 2;
int preegg2 = 20;
int prepine2 = 20;
int prenuts2 = 100;
int prechips2 = 100;
String code = new String();
int quantity = 0;
int numberOfBytesToRead = 10;
double total = 0.00;
double totalsum = 0.00;
System.out.println ("\n");
System.out.println ("------------------------
System.out.println (" Famouze Bakery, Madamme Memziers ");
System.out.println ("\n");
System.out.println ("Category Favorite Qty Prepared Qty Sold Selling Price($)); ");
System.out.println ("------------------------
System.out.print ("Cake [c1]Cheese" + " " + precheese + " " +soldcheese + " " +sellcheese);
System.out.print (" [c2]Chocolate" + " " + prechoc + " " +soldchoc + " " +sellchoc);
System.out.println (" [c3]Strawberry" + " " + prestraw + " " +soldstraw + " " +sellstraw);
System.out.println ("\n");
System.out.print ("Pastry [p1]Egg" + " " + preegg + " " +soldegg + " " +sellegg);
System.out.print (" [p2]Pineapple" + " " + prepine + " " +soldpine + " " +sellpine);
System.out.println ("\n");
System.out.print ("Cookie [k1]Pecan and Nuts" + " " + prenuts + " " +soldnuts + " " +sellnuts);
System.out.println (" [k2]Chocolate chips" + " " + prechips + " " +soldchips + " " +sellchips);
System.out.println ("\n");
System.out.println ("------------------------
System.out.println ("[S]ales [D]aily Order [C]ollection E[X]it");
System.out.println ("\n");
//char moreitems = 'y' ;
//char option = 'y' ;
char option;
System.out.print ("Option:" );
option = (char)System.in.read();
System.in.skip(2);
//System.out.println("\n")
switch(option){
case 's':{totalsum = 0.00;
char cont = 'y';
do {
System.out.println("Items sold:-");
System.out.println("enter product code:");
byte[] buffer = new byte[numberOfBytesToRead];
int bytesRead = System.in.read(buffer);
byte[] bufferRead = new byte[bytesRead - 2];
System.arraycopy(buffer, 0, bufferRead, 0, bytesRead - 2);
code = new String(bufferRead);
System.out.print("Enter quantity:");
bytesRead = System.in.read(buffer);
bufferRead = new byte[bytesRead - 2];
System.arraycopy(buffer, 0, bufferRead, 0, bytesRead - 2);
quantity = new Integer(new String(bufferRead)).intVal
if ("c1".equals(code))
{ if (quantity > precheese2)
{ System.out.println("not enough stock");}
else{
precheese2 = precheese2 - quantity;
soldcheese = soldcheese + quantity;
total = sellcheese * quantity;
totalsum = totalsum + total;
}
}
if ("c2".equals(code))
{ if (quantity > prechoc2)
{ System.out.println("not enough stock");}
else{
prechoc2 = prechoc2 - quantity;
soldchoc = soldchoc + quantity;
total = sellchoc * quantity;
totalsum = totalsum + total;
}
}
if ("c3".equals(code))
{ if (quantity > prestraw2)
{ System.out.println("not enough stock");}
else{
prestraw2 = prestraw2 - quantity;
soldstraw = soldstraw + quantity;
total = sellstraw * quantity;
totalsum = totalsum + total;
}
}
if ("p1".equals(code))
{ if (quantity > preegg2)
{ System.out.println("not enough stock");}
else{
preegg2 = preegg2 - quantity;
soldegg = soldegg + quantity;
total = sellegg * quantity;
totalsum = totalsum + total;
}
}
if ("p2".equals(code))
{ if (quantity > prepine2)
{ System.out.println("not enough stock");}
else{
prepine2 = prepine2 - quantity;
soldpine = soldpine + quantity;
total = sellpine * quantity;
totalsum = totalsum + total;
}
}
if ("k1".equals(code))
{ if (quantity > prenuts2)
{ System.out.println("not enough stock");}
else{
prenuts2 = prenuts2 - quantity;
soldnuts = soldnuts + quantity;
total = sellnuts * quantity;
totalsum = totalsum + total;
}
}
if ("k2".equals(code))
{ if (quantity > prechips2)
{ System.out.println("not enough stock");}
else{
prechips2 = prechips2 - quantity;
soldchips = soldchips + quantity;
total = sellchips * quantity;
totalsum = totalsum + total;
}
}
System.out.println("More Items(y/n) ?");
cont = (char) System.in.read();
}while (cont != 'n');
System.out.println("Total amount due =" +totalsum);
}
}
}
}
I'm sending you the whole code. I've made the necessary modifications to make it run. Just chk it over and tell me if ur satisfied. i changed the name to trial..pl do change to 1 which 'll suit u.
import java.io.*;
import java.io.InputStream;
import java.lang.*;
import java.util.*;
class trial
{
public static void main (String args[]) throws java.io.IOException
{
int precheese = 2;
int soldcheese = 0;
double sellcheese = 36.00;
int prechoc = 4;
int soldchoc = 0;
double sellchoc = 30.00;
int prestraw = 2;
int soldstraw = 0;
double sellstraw = 28.00;
int preegg = 20;
int soldegg = 0;
double sellegg = 1.20;
int prepine = 20;
int soldpine = 0;
double sellpine = 1.20;
int prenuts = 100;
int soldnuts = 0;
double sellnuts = 0.80;
int prechips = 100;
int soldchips = 0;
double sellchips = 0.70;
int precheese2 = 2;
int prechoc2 = 4;
int prestraw2 = 2;
int preegg2 = 20;
int prepine2 = 20;
int prenuts2 = 100;
int prechips2 = 100;
String code = new String();
int quantity = 0;
int numberOfBytesToRead = 10;
double total = 0.00;
double totalsum = 0.00;
System.out.println ("\n");
/*System.out.println("---- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -----");
System.out.println (" Famouze Bakery, Madamme Memziers ");
System.out.println ("\n");
System.out.println ("Category Favorite Qty Prepared Qty Sold Selling Price($) ");
System.out.println("------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---");
System.out.print ("[c1]Cheese "+ " " + precheese + " " +soldcheese + " " +sellcheese);
System.out.print ("[c2]Chocolate" + " " + prechoc + " " +soldchoc + " " +sellchoc);
System.out.println (" [c3]Strawberry" + " " + prestraw + " " +soldstraw + " " +sellstraw);
System.out.println ("\n");
System.out.print ("Pastry [p1]Egg" + " " + preegg + " " +soldegg + " " +sellegg);
System.out.print (" [p2]Pineapple" + " " + prepine + " " +soldpine + " " +sellpine);
System.out.println ("\n");
System.out.print ("Cookie [k1]Pecan and Nuts" + " " + prenuts + " " +soldnuts + " " +sellnuts);
System.out.println (" [k2]Chocolate chips" + " " + prechips + " " +soldchips + " " +sellchips);
System.out.println ("\n");
System.out.println("------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---");
System.out.println ("[S]ales [D]aily Order [C]ollection E[X]it");
System.out.println ("\n");
//char moreitems = 'y' ;
//char option = 'y' ;*/
char option;
System.out.print ("Option:" );
option = (char)System.in.read();
System.in.skip(2);
//System.out.println("\n") ;
switch(option){
case 's':
{
totalsum = 0.00;
String cont = "y";
do
{
System.out.println("Items sold:-");
System.out.println("enter product code:");
byte[] buffer = new byte[numberOfBytesToRead];
int bytesRead = System.in.read(buffer);
byte[] bufferRead = new byte[bytesRead - 2];
System.arraycopy(buffer, 0, bufferRead, 0, bytesRead - 2);
code = new String(bufferRead);
//System.out.println("code ="+code);
System.out.print("Enter quantity:");
bytesRead = System.in.read(buffer);
bufferRead = new byte[bytesRead - 2];
System.arraycopy(buffer, 0, bufferRead, 0, bytesRead - 2);
quantity = new Integer(new String(bufferRead)).intVal ue();
System.out.println("quanti ty="+quant ity);
if ("c1".equals(code))
{
System.out.println("c1.equ als(code)" );
if (quantity > precheese2)
{
System.out.println("not enough stock");
}
else
{
precheese2 = precheese2 - quantity;
soldcheese = soldcheese + quantity;
total = sellcheese * quantity;
totalsum = totalsum + total;
System.out.println("preche ese2="+pre cheese2);
System.out.println("soldch eese="+sol dcheese);
System.out.println("total= "+total);
System.out.println("totals um="+total sum);
}
}
if ("c2".equals(code))
{
System.out.println("c2.equ als(code)" );
if (quantity > prechoc2)
{
System.out.println("not enough stock");
}
else
{
prechoc2 = prechoc2 - quantity;
soldchoc = soldchoc + quantity;
total = sellchoc * quantity;
totalsum = totalsum + total;
System.out.println("precho c2="+prech oc2);
System.out.println("soldch oc="+soldc hoc);
System.out.println("total= "+total);
System.out.println("totals um="+total sum);
}
}
if ("c3".equals(code))
{
System.out.println("c3.equ als(code)" );
if (quantity > prestraw2)
{
System.out.println("not enough stock");
}
else
{
prestraw2 = prestraw2 - quantity;
soldstraw = soldstraw + quantity;
total = sellstraw * quantity;
totalsum = totalsum + total;
System.out.println("prestr aw2="+pres traw2);
System.out.println("soldst raw="+sold straw);
System.out.println("total= "+total);
System.out.println("totals um="+total sum);
}
}
if ("p1".equals(code))
{
System.out.println("p1.equ als(code)" );
if (quantity > preegg2)
{
System.out.println("not enough stock");
}
else
{
preegg2 = preegg2 - quantity;
soldegg = soldegg + quantity;
total = sellegg * quantity;
totalsum = totalsum + total;
System.out.println("preegg 2="+preegg 2);
System.out.println("soldeg g="+soldeg g);
System.out.println("total= "+total);
System.out.println("totals um="+total sum);
}
}
if ("p2".equals(code))
{
System.out.println("p2.equ als(code)" );
if (quantity > prepine2)
{
System.out.println("not enough stock");
}
else
{
prepine2 = prepine2 - quantity;
soldpine = soldpine + quantity;
total = sellpine * quantity;
totalsum = totalsum + total;
System.out.println("prepin e2="+prepi ne2);
System.out.println("soldpi ne="+soldp ine);
System.out.println("total= "+total);
System.out.println("totals um="+total sum);
}
}
if ("k1".equals(code))
{
System.out.println("k1.equ als(code)" );
if (quantity > prenuts2)
{
System.out.println("not enough stock");
}
else
{
prenuts2 = prenuts2 - quantity;
soldnuts = soldnuts + quantity;
total = sellnuts * quantity;
totalsum = totalsum + total;
System.out.println("prenut s2="+prenu ts2);
System.out.println("soldnu ts="+soldn uts);
System.out.println("total= "+total);
System.out.println("totals um="+total sum);
}
}
if ("k2".equals(code))
{
System.out.println("k2.equ als(code)" );
if (quantity > prechips2)
{
System.out.println("not enough stock");
}
else
{
prechips2 = prechips2 - quantity;
soldchips = soldchips + quantity;
total = sellchips * quantity;
totalsum = totalsum + total;
System.out.println("prechi ps2="+prec hips2);
System.out.println("soldch ips="+sold chips);
System.out.println("total= "+total);
System.out.println("totals um="+total sum);
}
}
System.out.println("More Items(y/n) ?");
DataInputStream user_input = new DataInputStream(System.in) ;
cont = user_input.readLine();
}
while (cont.equals("y")||cont.eq uals("y")) ;
System.out.println("Total amount due =" +totalsum);
}
}
}
}
import java.io.*;
import java.io.InputStream;
import java.lang.*;
import java.util.*;
class trial
{
public static void main (String args[]) throws java.io.IOException
{
int precheese = 2;
int soldcheese = 0;
double sellcheese = 36.00;
int prechoc = 4;
int soldchoc = 0;
double sellchoc = 30.00;
int prestraw = 2;
int soldstraw = 0;
double sellstraw = 28.00;
int preegg = 20;
int soldegg = 0;
double sellegg = 1.20;
int prepine = 20;
int soldpine = 0;
double sellpine = 1.20;
int prenuts = 100;
int soldnuts = 0;
double sellnuts = 0.80;
int prechips = 100;
int soldchips = 0;
double sellchips = 0.70;
int precheese2 = 2;
int prechoc2 = 4;
int prestraw2 = 2;
int preegg2 = 20;
int prepine2 = 20;
int prenuts2 = 100;
int prechips2 = 100;
String code = new String();
int quantity = 0;
int numberOfBytesToRead = 10;
double total = 0.00;
double totalsum = 0.00;
System.out.println ("\n");
/*System.out.println("----
System.out.println (" Famouze Bakery, Madamme Memziers ");
System.out.println ("\n");
System.out.println ("Category Favorite Qty Prepared Qty Sold Selling Price($) ");
System.out.println("------
System.out.print ("[c1]Cheese "+ " " + precheese + " " +soldcheese + " " +sellcheese);
System.out.print ("[c2]Chocolate" + " " + prechoc + " " +soldchoc + " " +sellchoc);
System.out.println (" [c3]Strawberry" + " " + prestraw + " " +soldstraw + " " +sellstraw);
System.out.println ("\n");
System.out.print ("Pastry [p1]Egg" + " " + preegg + " " +soldegg + " " +sellegg);
System.out.print (" [p2]Pineapple" + " " + prepine + " " +soldpine + " " +sellpine);
System.out.println ("\n");
System.out.print ("Cookie [k1]Pecan and Nuts" + " " + prenuts + " " +soldnuts + " " +sellnuts);
System.out.println (" [k2]Chocolate chips" + " " + prechips + " " +soldchips + " " +sellchips);
System.out.println ("\n");
System.out.println("------
System.out.println ("[S]ales [D]aily Order [C]ollection E[X]it");
System.out.println ("\n");
//char moreitems = 'y' ;
//char option = 'y' ;*/
char option;
System.out.print ("Option:" );
option = (char)System.in.read();
System.in.skip(2);
//System.out.println("\n")
switch(option){
case 's':
{
totalsum = 0.00;
String cont = "y";
do
{
System.out.println("Items sold:-");
System.out.println("enter product code:");
byte[] buffer = new byte[numberOfBytesToRead];
int bytesRead = System.in.read(buffer);
byte[] bufferRead = new byte[bytesRead - 2];
System.arraycopy(buffer, 0, bufferRead, 0, bytesRead - 2);
code = new String(bufferRead);
//System.out.println("code
System.out.print("Enter quantity:");
bytesRead = System.in.read(buffer);
bufferRead = new byte[bytesRead - 2];
System.arraycopy(buffer, 0, bufferRead, 0, bytesRead - 2);
quantity = new Integer(new String(bufferRead)).intVal
System.out.println("quanti
if ("c1".equals(code))
{
System.out.println("c1.equ
if (quantity > precheese2)
{
System.out.println("not enough stock");
}
else
{
precheese2 = precheese2 - quantity;
soldcheese = soldcheese + quantity;
total = sellcheese * quantity;
totalsum = totalsum + total;
System.out.println("preche
System.out.println("soldch
System.out.println("total=
System.out.println("totals
}
}
if ("c2".equals(code))
{
System.out.println("c2.equ
if (quantity > prechoc2)
{
System.out.println("not enough stock");
}
else
{
prechoc2 = prechoc2 - quantity;
soldchoc = soldchoc + quantity;
total = sellchoc * quantity;
totalsum = totalsum + total;
System.out.println("precho
System.out.println("soldch
System.out.println("total=
System.out.println("totals
}
}
if ("c3".equals(code))
{
System.out.println("c3.equ
if (quantity > prestraw2)
{
System.out.println("not enough stock");
}
else
{
prestraw2 = prestraw2 - quantity;
soldstraw = soldstraw + quantity;
total = sellstraw * quantity;
totalsum = totalsum + total;
System.out.println("prestr
System.out.println("soldst
System.out.println("total=
System.out.println("totals
}
}
if ("p1".equals(code))
{
System.out.println("p1.equ
if (quantity > preegg2)
{
System.out.println("not enough stock");
}
else
{
preegg2 = preegg2 - quantity;
soldegg = soldegg + quantity;
total = sellegg * quantity;
totalsum = totalsum + total;
System.out.println("preegg
System.out.println("soldeg
System.out.println("total=
System.out.println("totals
}
}
if ("p2".equals(code))
{
System.out.println("p2.equ
if (quantity > prepine2)
{
System.out.println("not enough stock");
}
else
{
prepine2 = prepine2 - quantity;
soldpine = soldpine + quantity;
total = sellpine * quantity;
totalsum = totalsum + total;
System.out.println("prepin
System.out.println("soldpi
System.out.println("total=
System.out.println("totals
}
}
if ("k1".equals(code))
{
System.out.println("k1.equ
if (quantity > prenuts2)
{
System.out.println("not enough stock");
}
else
{
prenuts2 = prenuts2 - quantity;
soldnuts = soldnuts + quantity;
total = sellnuts * quantity;
totalsum = totalsum + total;
System.out.println("prenut
System.out.println("soldnu
System.out.println("total=
System.out.println("totals
}
}
if ("k2".equals(code))
{
System.out.println("k2.equ
if (quantity > prechips2)
{
System.out.println("not enough stock");
}
else
{
prechips2 = prechips2 - quantity;
soldchips = soldchips + quantity;
total = sellchips * quantity;
totalsum = totalsum + total;
System.out.println("prechi
System.out.println("soldch
System.out.println("total=
System.out.println("totals
}
}
System.out.println("More Items(y/n) ?");
DataInputStream user_input = new DataInputStream(System.in)
cont = user_input.readLine();
}
while (cont.equals("y")||cont.eq
System.out.println("Total amount due =" +totalsum);
}
}
}
}
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ'd and pts refunded
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Venci75
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ'd and pts refunded
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Venci75
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
....
while (System.in.available() > 0) System.in.read();
System.out.println("enter product code:");
....
and
while (System.in.available() > 0) System.in.read();
System.out.println("Enter quantity:");
to clear the buffer before reading with
System.in.read(buffer);