## Kennedy_3

I have to create a program that accepts the number of tile as input from the keyboard, and returns the number of tiles to the main method. It has to accept the number of tiles and calculates the cost of each tiles. The method has to return the cost to the main method and prompt the user if he/she wants to purchase another item. I'm having trouble computing the subtotal, and how to keep a previous subtotal and add it to a new one they might be interested in... and further on down the line

Here's my code:

``````const int ART_STOP = 21;

int intCount = 0;

string inputString;
decimal[] payRate = new decimal[] { 9.24m, 6.08m, 1.13m, 6.05m, 4.12m };
string[] names = { "Ceramic", "Glass", "Metal", "Mosaic", "Stone" };
bool isNameValid = false;
int tileOrdered;
string prefMaterial;
decimal itemPrice = 0;
int counter = 0;
decimal subTotal;
char response;
decimal newTotal;

for (int count = 0; count <= ART_STOP; ++count)//this for loop adds ascii to the program by setting the count to zero
//and stops the art once it is greater than or equal to 20, and if not it adds one to it
{
Write("<3");//adds ascii to the program to make it more presentable
}
WriteLine("");
Write("   WELCOME TO KENNEDY'S HOUSE OF TILES!!!"   ); WriteLine("");

for (int count = 0; count <= ART_STOP; ++count)//this for loop adds ascii to the program by setting the count to zero
//and stops the art once it is greater than or equal to 20, and if not it adds one to it
{
Write("<3");//adds ascii to the program to make it more presentable
}
WriteLine("");
WriteLine("");

Write("Each tile purchased holds a value of \$7 each."); WriteLine("");

Write("Enter the amount of tile blocks you would like to purchase: ");
tileOrdered = Convert.ToInt32(inputString);

Write("Here is your list of tiles to choose from: "); WriteLine("");
WriteLine("");

WriteLine("-------------------");
WriteLine("Texture   |   Price");
WriteLine("-------------------");

for (intCount = 0; intCount < names.Length; ++intCount)
{
WriteLine("{0, 9} | {1}", names[intCount], payRate[intCount]);
}

WriteLine("");
Write("Enter the tile material you would like to purchase: ");

while (counter < names.Length && prefMaterial != names[counter])
{
counter++;
}
if (counter != names.Length)
{
isNameValid = true;
itemPrice = payRate[counter];
}

if (isNameValid)
{
Write("You have chosen the following: ");
ItemPreferred(prefMaterial, itemPrice);
}
else
{
WriteLine("Please enter a valid material ");
}

subTotal = DisplaySubTotal(tileOrdered, itemPrice);

Write("Do you want to select another tile to add? Y or N: ");
response = Convert.ToChar(inputString);
while (response == 'Y')
{
Write("Each tile purchased holds a value of \$7 each."); WriteLine("");

Write("Enter the amount of tile blocks you would like to purchase: ");
tileOrdered = Convert.ToInt32(inputString);

Write("Here is your list of tiles to choose from: "); WriteLine("");
WriteLine("");

WriteLine("-------------------");
WriteLine("Texture   |   Price");
WriteLine("-------------------");

for (intCount = 0; intCount < names.Length; ++intCount)
{
WriteLine("{0, 9} | {1}", names[intCount], payRate[intCount]);
}
while (counter < names.Length && prefMaterial != names[counter])
{
counter++;
}
if (counter != names.Length)
{
isNameValid = true;
itemPrice = payRate[counter];
}
Write("Enter the tile material you would like to purchase: ");

while (counter < names.Length && prefMaterial != names[counter])
{
counter++;
}
if (counter != names.Length)
{
isNameValid = true;
itemPrice = payRate[counter];
}

if (isNameValid)
{
Write("You have chosen the following: ");
ItemPreferred(prefMaterial, itemPrice);
}
else
{
WriteLine("Please enter a valid material ");
}

newTotal = subTotal +
(HERE IS WHAT I DO NOT UNDERSTAND, GETTING THE PREVIOUS TOTAL AND ADDING IT TO THE NEW ONE)

Write("Do you want to select another tile to add ? Y or N:");
response = Convert.ToChar(inputString);

}

}
private static void ItemPreferred(string names, decimal rate)
{
WriteLine("");
WriteLine("-------------------");
WriteLine("Texture   |   Price");
WriteLine("-------------------"); WriteLine("");
WriteLine("{0}     |    {1}", names, rate);
WriteLine("-------------------"); WriteLine("");
WriteLine("*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!");

}

private static decimal DisplaySubTotal(int tile, decimal payRate)
{
decimal sub;
const int RATE = 7;
sub = tile * RATE + payRate;
return sub;

}

}
}
``````

## tobyITguy 24

The code pasted is too much. What is the issue, paste the part with the issue.

## Kennedy_3

``````newTotal = subTotal +