loops and printing...

looping questions and get the answer to print at bottom of the

Page 1 of 1

2 Replies - 721 Views - Last Post: 07 October 2008 - 08:56 PM Rate Topic: -----

#1 Taccora  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 05-October 08

loops and printing...

Post icon  Posted 07 October 2008 - 06:17 PM

Okay so I'm finishing up a project and just realized that I needed to loop the questions so that it'll ask how many chicken panini's the customer wants, store that value and do the same for the roast beef sandwich. I also need help in getting the number (amount the customer wants) to be printed at the bottom to the "receipt" portion of the code.

The questions I need help being looped are lines 28-52 and the receipt portion or at least the start of it is at the bottom. What I need is someone to explain to me how to loop the questions (not really do it). I also need to know how to get the loop to stop after the customer chooses to finalize the order. That's the bold code.


using System;

public class OrdersTest
{

	public static void Main()
	{
		 
		//the following are order objects
		
		Orders order1 = new Orders( 0.00M );
		Orders order2 = new Orders( 0.00M );
		Orders order3 = new Orders( 0.00M );
		Orders order4 = new Orders( 0.00M );

		Console.WriteLine("Bleecker Street Menu");
		//the menu
		string prompt = "Jack Chicken Hot Panini - $5.99\nTarragon Roast Beef Sandwich - $4.99\nMandarin Cranberry Crunch Salad - $4.59\nSoup of the Day - $2.99";

		decimal orderAmount1; //the number the customer inputs for chicken
		decimal orderAmount2; //input for roast beef
		decimal orderAmount3; //input for salad
		decimal orderAmount4; //input for soup
		
		//display menu and ask question.  
		//Chicken order
		Console.WriteLine(prompt);
		Console.WriteLine("\n{0}",
			"Enter how many Jack Chicken Hot Panini's you want.");
		orderAmount1 = Convert.ToDecimal(Console.ReadLine());//where the customer input's their order
		order1.First(orderAmount1);
		Console.WriteLine("your total for the Jack Chicken Hot Panini is: {0:C}", order1.Balance);

		//Roat Beef Order
		Console.WriteLine("{0}",
		   "Enter how many Terragon Roast Beef Sandwich's you want.");
		orderAmount2 = Convert.ToDecimal(Console.ReadLine());//where the customer input's their order
		order2.Second(orderAmount2);
		Console.WriteLine("your total for the Terragon Roast Beef Sandwich is: {0:C}", order2.Balance);

		//Mandarin Salad Order
		Console.WriteLine("{0}",
		   "Enter how many Mandarin Cranberry Crunch Salad's you want.");
		orderAmount3 = Convert.ToDecimal(Console.ReadLine());//where the customer input's their order
		order3.Third(orderAmount3);
		Console.WriteLine("your total for the Mandarin Cranberry Crunch Salad is: {0:C}", order3.Balance);

		//Salad Order
		Console.WriteLine("{0}",
		   "Enter how many Salad of the Day's you want.");
		orderAmount4 = Convert.ToDecimal(Console.ReadLine());//where the customer input's their order
		order4.Fourth(orderAmount4);
		Console.WriteLine("your total for the Salad of the Day is: {0:C}", order4.Balance);


This post has been edited by Taccora: 08 October 2008 - 02:05 PM


Is This A Good Question/Topic? 0
  • +

Replies To: loops and printing...

#2 Taccora  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 05-October 08

Re: loops and printing...

Posted 07 October 2008 - 06:23 PM

* figured out how to edit and changed the main post*

This post has been edited by Taccora: 07 October 2008 - 09:26 PM

Was This Post Helpful? 0
  • +
  • -

#3 Taccora  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 05-October 08

Re: loops and printing...

Posted 07 October 2008 - 08:56 PM

I figured out how to do the receipt part of it but I'm still in need of help for the looping of the orders and stopping the customer's change from repeating.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1