I have 2 error messages that I am having trouble figuring out what it is asking me for. The errors are:
Desktop\Inventory Program\InventoryPart1.java:93: cannot find symbol
symbol : variable printer
location: class InventoryPart1
System.out.println("Item Number: " + printer.getItemNumber());
Desktop\Inventory Program\InventoryPart1.java:95: cannot find symbol
symbol : variable printer`enter code here`
location: class InventoryPart1
System.out.println("Product Name: " + printer.getProductName());
The code so far is
import java.text.NumberFormat;
import java.util.locale;
import java.util.Scanner;
class Printer {
private String itemNumber;
private String productName;
private double units;
private double unitPrice;
private double unitsTotal;
//constructor
public Printer (String itemNumber, String productName, double units, double unitsTotal) {
setItemNumber(itemNumber);
setProductName(productName);
setUnits(units);
setUnitPrice(unitPrice);
unitsTotal = units ++;
}
//accessor methods for class variables
public String getItemNumber () {
return itemNumber;
}
public void setItemNumber (String itemNumber) {
this.itemNumber = itemNumber;
}
public String getProductName () {
return productName;
}
public void setProductName (String productName) {
this.productName = productName;
}
public double getUnits () {
return units;
}
public void setUnits (double units) {
this.units = units;
}
public double getUnitPrice () {
return unitPrice;
}
public void setUnitPrice (double unitPrice) {
this.unitPrice = units * unitPrice;
}
public double getUnitsTotal () {
return unitsTotal;
}
public void setUnitsTotal (double unitsTotal) {
this.unitsTotal = units ++;
}
}
public class InventoryPart1 {
public static void main (String args[]) {
int units;
double unitPrice;
double unitsTotal;
unitsTotal = units ++;
double unitsPrice;
unitsPrice = units * unitPrice;
double unitsTotalPrice;
unitsTotalPrice = unitsTotal * unitPrice;
double totalInventory;
totalInventory = unitsTotal * unitsTotalPrice;
NumberFormat nf = NumberFormat. getCurrencyInstance(Locale.US);
//create an instance of the Printer class
Printer epson = new Printer ("Epson579", "All In One", 2, 50.99);
//use the methods from class Printer to output the inventory details.
System.out.println("Item Number: " + printer.getItemNumber());
System.out.println("Product Name: " + printer.getProductName());
System.out.print("Number of Units: ");
System.out.println(nf.format(units));
System.out.print("Unit Price: ");
System.out.println(nf.format(unitPrice));
System.out.print("Units Total: ");
System.out.println(nf.format(unitsTotal));
System.out.print("Units Total Price: ");
System.out.println(nf.format(unitsTotalPrice));
System.out.print("Total Inventory: ");
System.out.println(nf.format(totalInventory));
}
}
Sorry new to this site and still trying to figure things out with the whole code entering,
No comments:
Post a Comment