Saturday, June 13, 2020

Sally Grocery Ordering System in C#

I wrote this program to demonstrate how to create and implement an ordering system using C# programming language. I called this program Sally Grocery Ordering System.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, IT projects, school and application development, programming projects, thesis, and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.My mobile number here in the Philippines is 09173084360. My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.

Here in Bacolod City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/



Sample Program Output


Program Listing

// Author  : Jake Rodriguez Pomperada
// Date    : June 13, 2020   6:21 AM Saturday
// Website : www.jakerpomperada.com
// Email   : jakerpomperada@gmail.com

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Grocery_Ordering_System
{
    class Program
    {
        static void Main(string[] args)
        {

            int p0 = 0,p1 = 0,p2 = 0,p3 = 0,p4 = 0,p5 = 0,payment=0;

            double sum = 0.00,total_cost = 0.00;
           
            char decision;

            double total_price = 0.00;

            int[] final_qty = new int[100];

            int[] product_number = { 0, 1, 2, 3, 4, 5 };

            string[] product_title = { "Product Number", "Product Name", "Item Price" };

            string[] product_title2 = { "Product Name", "Quantity", "Item Price", "Total Cost" };

            string[] product_name = {"555 Tuna","Nido Milk", "Magic Flakes",
                                     "Milo Mix","LuckyMe Noodles","Century Tuna"};

            double[] item_price = {21.71,25.43,37.28,43.17,12.43,26.81};

            do
            {
                Console.WriteLine("\n");
                Console.WriteLine("\t\t===== Sally Grocery Ordering System in C# =====");
                Console.WriteLine();
                Console.WriteLine("\t" + product_title[0] + "\t" + product_title[1] + "\t   " + product_title[2]);
                Console.WriteLine();
                for (int a = 0; a < product_name.Length; a++)
                {
                    Console.WriteLine("\t\t" + product_number[a] + "\t" + product_name[a] + "\t    " + item_price[a].ToString("00.00"));
                }

                Console.WriteLine();
                Console.Write("\tSelect the Product Number to choose the Product :  ");
                int choose = Convert.ToInt32(Console.ReadLine());

                Console.Write("\tHow many pieces?  ");
                int quantity = Convert.ToInt32(Console.ReadLine());



                switch (choose)
                {
                    case 0:
                        p0 += quantity;
                        final_qty[0] = p0;
                        break;

                    case 1:
                        p1 += quantity;
                        final_qty[1] = p1;
                        break;

                    case 2:
                        p2 += quantity;
                        final_qty[2] = p2;
                        break;

                    case 3:
                        p3 += quantity;
                        final_qty[3] = p3;
                        break;

                    case 4:
                        p4 += quantity;
                        final_qty[4] = p4;
                        break;


                    case 5:
                        p5 += quantity;
                        final_qty[5] = p5;
                        break;

                  
                }

                Console.WriteLine();
                Console.Write("\tWould you like to order again? Y/N : ");
                decision = char.ToUpper(Console.ReadKey().KeyChar);
                Console.WriteLine();

            } while (decision != 'N');
         
            Console.WriteLine("\n");
          Console.WriteLine("\t===== FINAL PURCHASE =====");
         Console.WriteLine("\t\t" + product_title2[0] + "\t\t" + product_title2[1]
                    + "\t" + product_title2[2] + "\t" + product_title2[3]);
    
for(int i=0; i < final_qty.Length; i++)
{
if(final_qty[i] != 0)
{
                
                double compute_two = final_qty[i] * item_price[i];
                Console.WriteLine("\t\t" + product_name[i] + "\t\t  "
                               + final_qty[i] + "\t\t " + item_price[i].ToString("#####.00")
                               + "\t\t PHP " + compute_two.ToString("#####.00"));
            
sum = sum + final_qty[i]*item_price[i];
}
}
        Console.WriteLine();
        Console.WriteLine("\tTotal Number of Purchased items: " + (p0 + p1 + p2 + p3 + p4 + p5));
        Console.WriteLine();
        Console.WriteLine("\tTotal Purchase PHP : " + sum.ToString("#####.00")); 
do
{
        Console.WriteLine();
Console.Write("\tEnter Your Payment  PHP : ");
        payment = Convert.ToInt32(Console.ReadLine());
}while(sum > payment);
        double compute_all = (payment - sum);
        Console.WriteLine();
Console.WriteLine("\tYour Change is PHP : "+ compute_all.ToString("#####.00"));
        Console.WriteLine();
        Console.WriteLine("\t\tThank you for buying at Sally's Grocery.");
        Console.WriteLine();
        Console.Write("\t\tEND OF PROGRAM");
        Console.ReadKey();
        }

 }
       
}  // End of Code





No comments:

Post a Comment