collapse collapse

* Recent News

Meta Connect 2024 by Tbone
[September 25, 2024, 01:37:22 pm]


Fifth Matrix Film Announced! by Lithium
[April 07, 2024, 09:49:37 pm]


Quest Headsets Will No Longer Require Facebook Account by Tbone
[July 07, 2022, 03:17:21 pm]


New Matrix Online? "Matrix Awakens" UE5 Demo by Tbone
[December 28, 2021, 01:05:59 pm]

* Recent Posts

FA in DC? by Subb
[November 01, 2024, 03:55:27 pm]


Meta Connect 2024 by Tbone
[September 25, 2024, 01:37:22 pm]


Fifth Matrix Film Announced! by Lithium
[April 07, 2024, 09:49:37 pm]


2024: New PC for VR! by Tbone
[April 06, 2024, 12:22:30 pm]


MOVED: Fifth Matrix Film Announced! by Tbone
[April 06, 2024, 12:18:27 pm]


Holiday Fun by Tbone
[March 01, 2024, 09:09:44 pm]


Quest 2 Link Best Settings (Finally Better Than Rift S) by Tbone
[November 27, 2023, 04:57:46 pm]


randomness by Jeyk
[November 27, 2023, 09:42:30 am]

Author Topic: Java Help  (Read 1580 times)

Offline Heironymus

  • Angelic Fury
  • ******
  • Join Date: May 2005
  • Posts: 1488
    • View Profile
    • http://www.xanga.com/Inner_Fatman
Java Help
« 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

Offline Fuse

  • VETERAN ANGEL
  • *******
  • Join Date: Jan 2005
  • Posts: 3902
    • View Profile
    • http://www.lostlocalhost.com
Re: Java Help
« Reply #1 on: June 11, 2007, 01:27:11 am »
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...

Offline Heironymus

  • Angelic Fury
  • ******
  • Join Date: May 2005
  • Posts: 1488
    • View Profile
    • http://www.xanga.com/Inner_Fatman
Re: Java Help
« Reply #2 on: July 04, 2007, 01:46:08 pm »
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..

Quote
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

Code: [Select]
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
Code: [Select]

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();

}
}

Offline Heironymus

  • Angelic Fury
  • ******
  • Join Date: May 2005
  • Posts: 1488
    • View Profile
    • http://www.xanga.com/Inner_Fatman
Re: Java Help
« Reply #3 on: July 05, 2007, 09:01:37 pm »
Please.. help.. someone...

Offline Jeyk

  • VETERAN ANGEL
  • *******
  • Join Date: Apr 2005
  • Posts: 1846
    • View Profile
    • http://www.followtheangel.org
Re: Java Help
« Reply #4 on: July 06, 2007, 01:30:09 am »
OMG, what the hell is that?

Did you check to make sure it's plugged in? :p

Offline Eroz

  • VETERAN ANGEL
  • *******
  • Join Date: May 2004
  • Posts: 2015
    • View Profile
Re: Java Help
« Reply #5 on: July 06, 2007, 02:14:10 am »
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).
"Have you ever tried to dismantle a snowball?" - Linus, Peanut's Gang.

Offline Heironymus

  • Angelic Fury
  • ******
  • Join Date: May 2005
  • Posts: 1488
    • View Profile
    • http://www.xanga.com/Inner_Fatman
Re: Java Help
« Reply #6 on: July 08, 2007, 08:33:58 pm »
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..

Offline Eroz

  • VETERAN ANGEL
  • *******
  • Join Date: May 2004
  • Posts: 2015
    • View Profile
Re: Java Help
« Reply #7 on: July 09, 2007, 12:17:56 am »
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.
"Have you ever tried to dismantle a snowball?" - Linus, Peanut's Gang.

 

 

* Discord

Calendar

November 2024
Sun Mon Tue Wed Thu Fri Sat
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 [26] 27 28 29 30

No calendar events were found.

* Who's Online

  • Dot Guests: 162
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

Social