Hiya,
I am new to java, I have a very fast paced class and I am learning as much as I can as quickly as I can. I have previous experince with C++ but it will not help here. My Question:
WHY WILL MY PROGRAM NOT RUN!!??
*It compiles and creates a class but does nothing.
*
Here is the code:
class Mobilephone { //class name and attributes
public static void main(String []args) {
}
private int SerialNumber; //serial number of product
private int ItemNumber; //item # of product
private double UnitsStock; //# of units in stock
private double UnitPrice; //Price per unit
private double InventoryValue; //The dollar value of the inventory in stock
private String Department; //The department the product belongs to
private String ProductName; //product name
//constructor
public Mobilephone (int item, int serial, double units, double price, double value, String product, String Dept) {
ItemNumber = item;
SerialNumber = serial;
UnitsStock = units;
UnitPrice = price;
InventoryValue = value;
ProductName = product;
Department = Dept;
} //end constructor
///getter and setter methods for Mobilephone
public void setItemNumber (int item) { //setter for item number
this.ItemNumber = item;
} //end setter item number
public int getItemNumber() { //getter for item number
return ItemNumber;
} //end getter item number
public void setSerialNumber (int serial) { //setter for serial number
this.SerialNumber = serial;
}//end setter for serial number
public int getSerialNumber() { //getter for serial number
return SerialNumber;
}//end getter for serial number
public void setUnitsStock (double units) { //setter for units in stock
this.UnitsStock = units;
} //end setter units in stock
public double getUnitsStock() { //getter for units in stock
return UnitsStock;
} //end getter units in stock
public void setUnitPrice (double price) { //setter for unit price
this.UnitPrice = price;
} //end setter unit price
public double getUnitPrice() { //getter for unit price
return UnitPrice;
} //end getter for unit price
public void setInventoryValue (double value) { //setter for inventory value
this.InventoryValue = value;
} //end setter inventory value
public double getInventoryValue() { //getter for Inventory Value
return InventoryValue;
} //end getter for Inventory Value
public void setProductName (String product) { //setter for product name
this.ProductName = product;
} //end setter product name
public String getProductName() { //getter for product name
return ProductName;
} //end getter product name
public void setDepartment (String dept) { //setter for department
this.Department = dept;
} //end setter Department
public String getDepartment() { //getter for department
return Department;
} //end getter Department
//calculate individual product inventory value
public double getInventoryStockValue(){
return UnitsStock * UnitPrice;
}//end calculate individual product inventory value
//calculate total inventory value
public double calculateInventory(){
return UnitPrice * UnitsStock;
}//end calculate total inventory value
///end getter and setter methods for Mobilephone
} //end class Mobilephone
Chuck that into editor and save as .java. Javac and creates class. Run java and nothing happends...Annoying.