Commit 31614d54 authored by robert.sharp's avatar robert.sharp

updated broken variables;

parent d7539e9d
......@@ -296,7 +296,7 @@ public class temp extends javax.swing.JFrame {
//find the items index
PriceLabel.setText("Price: " + price[index]);
//returns it's price.
cost = price[index]*quant;
cost = price[index]*(quant*2);
Total.setText("Total: "+ cost);
}
......@@ -306,11 +306,11 @@ public class temp extends javax.swing.JFrame {
private void quantBoxActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
findItem();
quant = Double.parseDouble(quantBox.getSelectedItem().toString());
quant = Double.parseDouble(quantBox.getSelectedItem().toString()) /2;
//find the slected item and convet it into a double
quantLabelchange.setText("Selected quantity: "+quant);
quantLabelchange.setText("Selected quantity: "+(quant*2));
//update the display to show the quanity of item
cost = price[index]*quant;
cost = price[index]*(quant*2);
Total.setText("Total: "+ cost);
}
......@@ -463,9 +463,9 @@ public class temp extends javax.swing.JFrame {
}
f.write(""+price[i]+"\t");
//displays the price
f.write((basket[i]/2)+"\t");
f.write((basket[i])+"\t");
//this is because for some reason the basket quanity was being doubled;
cost = cost + ((price[i]) * (basket[i]/2));
cost = cost + ((price[i]) * (basket[i]));
//adds a new line to display the next item.
f.write("\n");
}
......@@ -475,13 +475,6 @@ public class temp extends javax.swing.JFrame {
f.write("\n" + "Total payed: " + payed + "\n");
f.write("\n" + "Change Given: " + (payed-cost) + "\n");
if (change >= 0){
f.write("\n" + "valid payment: " + true);
} else {
f.write("\n" + "valid payment: " + false);
f.write("\n" + "Service Denied.");
}
f.write("\n________________________________");
f.close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment