Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 131,550 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,230 people online right now. Registration is fast and FREE... Join Now!




loops and printing...

 
Reply to this topicStart new topic

loops and printing..., looping questions and get the answer to print at bottom of the

Taccora
post 7 Oct, 2008 - 05:17 PM
Post #1


New D.I.C Head

*
Joined: 5 Oct, 2008
Posts: 8

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.


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: 8 Oct, 2008 - 01:05 PM
User is offlineProfile CardPM

Go to the top of the page


Taccora
post 7 Oct, 2008 - 05:23 PM
Post #2


New D.I.C Head

*
Joined: 5 Oct, 2008
Posts: 8

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

This post has been edited by Taccora: 7 Oct, 2008 - 08:26 PM
User is offlineProfile CardPM

Go to the top of the page

Taccora
post 7 Oct, 2008 - 07:56 PM
Post #3


New D.I.C Head

*
Joined: 5 Oct, 2008
Posts: 8

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.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 02:30AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month