The Furious Angels
FA Discussion => Off Topic => Topic started by: Heironymus on June 11, 2007, 12:53:57 am
-
I know we have some programmers in this faction.. will any of you volunteer to help me out.. I am three weeks into a 9 week course and it is kicking me in the ass.. I just need to ask questions and get some layman's responses.. and maybe look over my code when I can't figure out the problem..
Anyone willing to help? It would be greatly appreciated.. if you still have an active account I will give you all the $info I have to pass this class..
Thanks
-
I haven't taken java in a while, but I know my way around code. Post stuff here in the forum, or PM me and I'll do what I can to help...
-
I know this is a holiday and all.. but if anyone can help me I would be SOOOO appreciative... like seriously.. I might even be willing to donate a few to the paypal fund for tutoring ;)
Anyways.. I will post my requirements.. my code that I have so far... and what I think I need to do but not sure how to get it done.. I don't necessarily want you to "do" it for me.. but a REALLLLLY good walk through example would be great.. if you are feeling froggy and want to show me the correct code that is fine also..
Thanks in advance for anyone who helps..
Modify the Inventory Program so the application can handle multiple items. Use an array to store the items. The output should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the output should display the value of the entire inventory.
Create a method to calculate the value of the entire inventory
Create another method to sort the array items by the name of the product
Modify the Inventory Program by creating a subclass of the product class that uses one additional unique feature of the product you chose (for the DVDs subclass, you could use movie title, for example).
Create a method in the subclass 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
That is what I have to do.. I already modified so that it adds the total inventory together.. I just need to have it Sort and (I think) add separate subclass to add the restocking fee...
PLEASE HELP!!!
Here is the Code
This is Inventory.java
public class Inventory
{
private String nameProduct[];
private int itemNumber[];
private int productNumber[];
private double productPrice[];
//contructor initializes itemProduct, itemNumber array, productnumber array, and productprice array
public Inventory( String nameArray[], int itemArray[], int productnumberArray[], double productpriceArray[] )
{
nameProduct = nameArray; //store itemProduct
itemNumber = itemArray; //store itemNumber
productNumber = productnumberArray; //store productnumber
productPrice = productpriceArray; //store productprice
}
}
This is InventoryGUI.java
public class InventoryGUI
{
//Main Method
public static void main( String args[] )
{
//Product Name Array
String nameArray[] = {"Intel Celeron CPU", "Intel Core Duo CPU", "AMD Athlon 64 CPU"};
int itemArray[] = { 1, 2, 3};
int productnumberArray[] = {15, 3, 8};
double productpriceArray[] = {65, 200, 135};
Inventory myInventory = new Inventory( nameArray,itemArray, productnumberArray, productpriceArray );
double valueInventory0 = productnumberArray[0] * productpriceArray[0];
double valueInventory1 = productnumberArray[1] * productpriceArray[1];
double valueInventory2 = productnumberArray[2] * productpriceArray[2];
double totalInventory = valueInventory0 + valueInventory1 + valueInventory2;
System.out.println();
System.out.printf("The first product is %s, item %d.\nThe product in stock is %d and each cost $%.2f.\nThe total price of all the inventoried product is $%.2f.\n", nameArray[0], itemArray[0], productnumberArray[0], productpriceArray[0], valueInventory0 );
System.out.println();
System.out.printf("The second product is %s, item %d.\nThe product in stock is %d and each cost $%.2f.\nThe total price of all the inventoried product is $%.2f.\n", nameArray[1], itemArray[1], productnumberArray[1], productpriceArray[1], valueInventory1 );
System.out.println();
System.out.printf("The third product is %s, item %d.\nThe product in stock is %d and each cost $%.2f.\nThe total price of all the inventoried product is $%.2f.\n", nameArray[2], itemArray[2], productnumberArray[2], productpriceArray[2], valueInventory2 );
System.out.println();
System.out.printf("The total value of the instock inventory is $%.2f.\n", totalInventory);
System.out.println();
}
}
-
Please.. help.. someone...
-
OMG, what the hell is that?
Did you check to make sure it's plugged in? :p
-
Yes, I am a programmer by trade, but i know no Java. So can't help here.
I'm going to try to find you on AIM sometime, see what you looking directly for help, because i can do most of that in C++ (vectors for the win).
-
This is the post where I will post my updated code.. I can't get it to compile.. but... hopefully fuse or someone can look at it an tell me whats wrong..
Eroz, it has to be in Java language... Thanks though..
-
Oh I orginially wrote the C++ comment then edited the message, looking back on it I can give the general ideas on how to get things done, you would still have to write code. Remember there are only like 8 major ideas in programming, once you learn them you can write in a pseduo code. Plus I wanted to see if you where having problems with how to do the functions themselves or just the code overall.