this is what i have to do:
Choose a product that lends itself to an inventory (for example, products at your workplace, office supplies, music CDs, DVD movies, or software).
• Create a product class that holds the item number, the name of the product, the number of units in stock, and the price of each unit.
• Create a Java application that displays the product number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory (the number of units in stock multiplied by the price of each unit). Pay attention to the good programming practices in the text to ensure your source code is readable and well documented.
this is what i have so far:
Expand|Select|Wrap|Line Numbers
- // Product class
- public class Product {
- private String title;
- private double item;
- private double stock;
- private double price;
- // Constructor to initialize the product information.
- public Product(String title, double item, double stock,
- double price) {
- setTitle(title);
- setItem(item);
- setStock(stock);
- setPrice(price);
- }
- // Method to get the title
- public String getTitle() {
- return title;
- }
- // Method to get the item number
- public double getItem() {
- return item;
- }
- //Method to get the stock
- public double getStock() {
- return stock;
- }
- //Method to get the price
- public double getPrice() {
- return price;
- }
- // Method to set the title name.
- public void setTitle(String title) {
- this.title = title;
- }
- // Method to set the item number.
- public void setItem(double item) {
- this.item = item;
- }
- // Method to set the stock available.
- public void setStock(double stock) {
- this.stock = stock;
- }
- //Method to set the price.
- public void setPrice(double price) {
- this.price = price;
- }
- // Method to compute the value of inventory.
- public double getInvValue() {
- return this.stock *this.price;
- }
- }
java.lang.NoSuchMethodError: main
Exception in thread "main"
Process completed.
how do i fix this? do i need to add more? please help!
or am i going about this wrong???