Hello,
I have to create a product class that holds the item number, product name, units in stock, and the unit price.
I also have to create a java application that displays the same info.
I have been working on this for three days now... I am getting frustrated because it is due tonight and it doesn't seem to work.
A little help will be very much appreciated..
Here is what I have so far:
import java.util.Arrays;
public class InventoryProgramPart1
{
public static void main(String[] args)
{
InventoryProgramPart1 invProgram = new InventoryProgramPart1();
invProgram.musicCD();
}
String musicCd[] = { "Fergie", "Celine Dion","Kelly Clarkson", "Chris Daughtry"};
double itemNum;
double count[] = {5, 7, 3, 8};
double totalValue [] = new double [4];
double price[] = { 19.95, 21.99, 16.50, 21.75};
double totalInvVal;
// Method for printing CD Titles
public void musicCd()
{
// For loop to calculate total value
Arrays.sort(musicCd);
for( int itemNum = 0; itemNum < musicCd.length; itemNum ++ )
totalValue[itemNum] = count[itemNum] * price[itemNum];
System.out.printf( "%s %15s %12s %12s %12s\n", "Item Number", "CD Title", "Price", "Stock", "Total");
for ( int itemNum = 0; itemNum <musicCd.length; itemNum ++ )
System.out.printf("%-8d %20s %10.02f %12.02f %12.02f\n",
itemNum, musicCd[itemNum], price [itemNum],count[itemNum], totalValue[itemNum]);
} // end of method to print dvdName
// Method for total value of the inventory
public void totalInvValue()
{ //start of method to calculate the total inventory value
totalInvVal = count [0] * price [0] + count [1] * price [1] + count [2] * price [2] + count [3] * price [3];
System.out.printf("%s", "The Total Value of the Inventory is:","%10.02f");
System.out.printf("$%.02f", totalInvVal);
} // end of method
} // end public class InventoryProgramPart1
and here is the error:
Cannot find the symbol
Symbol: method musicCd()
Location: class InventoryProgramPart1
invProgram.musicCD();