3 Replies - 593 Views - Last Post: 26 March 2009 - 04:35 PM Rate Topic: -----

#1 jonzgirl9267  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 23-March 09

I need help on my inventory project

Posted 26 March 2009 - 01:27 PM

I am having a hard time figuring out if I am doing more with this checkpoint then what I am suppose to do.

The checkpoint asks for : Choose a product that lends itself to an inventory. 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.

I have this and it compiles and runs but I just want to make sure that it is what I am suppose to do and what is required in this checkpoint.

package javaapplication3;

/**
*
* @author Jonzgirl
*/

import java.util.Scanner;
public class Main {



public static void main(String[] args) {

DVD dvd;

dvd = new DVD("Madea goes to Jail", 4, 19.99, 100);
System.out.println(dvd);
System.out.println("Product Title is " + dvd.getDvdTitle());
System.out.println("The number of units in stock is " + dvd.getDvdStock());
System.out.println("The price of each DVD is " + dvd.getDvdPrice());
System.out.println("The item number is " + dvd.getDvdItem());
System.out.println("The value of the inventory is " + dvd.value());

dvd = new DVD ("BeetleJuice", 8, 19.99, 101);
System.out.println(dvd);
System.out.println("Product Title is " + dvd.getDvdTitle());
System.out.println("The number of units in stock is " + dvd.getDvdStock());
System.out.println("The price of each DVD is " + dvd.getDvdPrice());
System.out.println("The item number is " + dvd.getDvdItem());
System.out.println("The value of the inventory is " + dvd.value());

dvd = new DVD ("Resident Evil", 10, 19.99, 102);
System.out.println(dvd);
System.out.println("Product Title is " + dvd.getDvdTitle());
System.out.println("The number of units in stock is " + dvd.getDvdStock());
System.out.println("The price of each DVD is " + dvd.getDvdPrice());
System.out.println("The item number is " + dvd.getDvdItem());
System.out.println("The value of the inventory is " + dvd.value());

dvd = new DVD ("Office Space", 8, 19.99, 103);
System.out.println(dvd);
System.out.println("Product Title is " + dvd.getDvdTitle());
System.out.println("The number of units in stock is " + dvd.getDvdStock());
System.out.println("The price of each DVD is " + dvd.getDvdPrice());
System.out.println("The item number is " + dvd.getDvdItem());
System.out.println("The value of the inventory is " + dvd.value());

}//end class main

} // end class Inventory1

class InventoryList{

private String name;
private int nbInStock;
private double price;
private int itemNumber;
//end InventoryList

InventoryList(String pName, int nb, double priceEach, int itemNum){
itemNumber = itemNum;
name = pName;
nbInStock = nb;
price = priceEach;
} //end InventoryList constructor

}
class DVD {
private String dvdTitle;
private double dvdStock;
private double dvdPrice;
private double dvdItem;
//end four-argument constructor

public DVD(String title, double stock, double price, double item) {
dvdTitle = title;
dvdStock = stock;
dvdPrice = price;
dvdItem = item;
} //end DVD


public void setDvdTitle(String title) {
dvdTitle = title;
} //end method setDvdTitle

//return DVD Title
public String getDvdTitle() {
return dvdTitle;
} //end method getDvdTitle

//set DVD Stock
public void setDvdStock(double stock) {
dvdStock = stock;
} //end method setDvdStock

//return DvdStock
public double getDvdStock() {
return dvdStock;
} //end method get Dvdstock

public void setDvdPrice(double price) {
dvdPrice = price;
} //end method setDvdPrice

//return dvdPrice
public double getDvdPrice() {
return dvdPrice;
} //end method get Dvd Price

public void setDvdItem(double item) {
dvdItem = item;
} //end method setdvdItem

//return DVD item
public double getDvdItem() {
return dvdItem;
} //end method getDvdItem

//calculate inventory value
public double value() {
return dvdPrice * dvdStock;
} //end method value

} //end class DVD

class Product{
int arrayLength=5;
int dvdNumber[] = new int[arrayLength];
String dvdName[] = new String[] {"Madea goes to Jail", "BeetleJuice", "Office Space", "Resident Evil", "Dogma"};
int dvdUnits[] = {5, 3, 2, 2, 3};
double dvdPrice[] = {19.95, 19.95, 15.95, 15.95, 19.95};
double dvdValue[] = new double[arrayLength];
//end method
} //end class Product


Can someone tell me if I am on the right track, I would greatly appreciate it.

Is This A Good Question/Topic? 0
  • +

Replies To: I need help on my inventory project

#2 buniwai  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 67
  • Joined: 10-December 08

Re: I need help on my inventory project

Posted 26 March 2009 - 01:31 PM

I just did this project and Im not sure which school you go to but all that you descibed is all the my instructor required.

If it is running and compiling fine then you should be good.
Was This Post Helpful? 0
  • +
  • -

#3 jonzgirl9267  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 23-March 09

Re: I need help on my inventory project

Posted 26 March 2009 - 04:08 PM

View Postbuniwai, on 26 Mar, 2009 - 12:31 PM, said:

I just did this project and Im not sure which school you go to but all that you descibed is all the my instructor required.

If it is running and compiling fine then you should be good.





Thank you so much. I am so new to this. I do not even think I am making the posts here right. I feel so confused and lost. I am even struggling on how to do part 2 of the inventory. Would you have any suggestions? Should I write what the questions is asking for so you can see? Please let me know because I need help and I would appreciate any that you can give me. Hopefully we will talk soon.
Was This Post Helpful? 0
  • +
  • -

#4 jonzgirl9267  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 23-March 09

Re: I need help on my inventory project

Posted 26 March 2009 - 04:35 PM

View Postjonzgirl9267, on 26 Mar, 2009 - 03:08 PM, said:

View Postbuniwai, on 26 Mar, 2009 - 12:31 PM, said:

I just did this project and Im not sure which school you go to but all that you descibed is all the my instructor required.

If it is running and compiling fine then you should be good.





Thank you so much. I am so new to this. I do not even think I am making the posts here right. I feel so confused and lost. I am even struggling on how to do part 2 of the inventory. Would you have any suggestions? Should I write what the questions is asking for so you can see? Please let me know because I need help and I would appreciate any that you can give me. Hopefully we will talk soon.



I thought I would go ahead and write out the question so you can see it. Here it goes: Modify the Inventory Program by creating a subclass of the product class that uses one additional unique feature of the product you chose. In the subclass, create a method to calculate the value of the inventory of a product with the same name as the method previously created for the product class. The subclass method should also add a 5% restocking fee to the value of the inventory of that product. Modify the output to display this additional feature you have chosen and the restocking fee.

I am lost now. If you look at the code that I sent you and you thought was just fine, should have I put the class inventory list and class product on there. Or would that be considered what is being done in part 2 of this.

I hope you don't mind the questions. I have been looking over all this and it just seems to be confusing to me and I can't find someone with the patience to help me out. Can you please. Hope you to hear from you soon.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1