Sunday, March 16, 2014

Switch_Structure_Ex_2: (Wk-4), Jan 27-31, 2014

Question: A training company conducts its workshops in the six locations shown as bellow:
Location                        Lodging Fee per day
1. Austin                       $ 150.00
2. Chicago                    $ 225.00
3. Dallas                       $ 175.00
4. Orlando                    $ 300.00
5. Phoenix                    $ 175.00
6. Raleigh                      $ 150.00
Workshop                     Number of days         Reg Fee
1. Handling Stress                  3                       $1000.00
2. Time Management              3                       $800.00
3. Negotiation                        3                       $1500.00
4. Supervision skills               5                        $1300.00
Request from the user the location and workshop then determine the total cost.

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

namespace Switch_Structure_Ex_2
{
    class Program
    {
        static void Main(string[] args)
        {
            repeat:
            Console.WriteLine("Workshop Location & Lodging Fee: ");
            Console.WriteLine("\t1. Austin  \t$150.00");
            Console.WriteLine("\t2. Chicago \t$225.00");
            Console.WriteLine("\t3. Dallas  \t$175.00");
            Console.WriteLine("\t4. Orlando \t$300.00");
            Console.WriteLine("\t5. Phoenix \t$175.00");
            Console.WriteLine("\t6. Raleigh \t$150.00");
            Console.WriteLine();
            Console.Write("\nSelect your location: ");
            int location = int.Parse(Console.ReadLine());

            switch (location)
            {
                case 1:
                    {
                        Console.WriteLine("\nWorkshop, Number of days and Reg fee: ");
                        Console.WriteLine("\t1. Handling Stress   (3) days \t$1000.00");
                        Console.WriteLine("\t2. Time Management   (3) days \t$800.00");
                        Console.WriteLine("\t3. Negotiation       (3) days \t$1500.00");
                        Console.WriteLine("\t4. Supervision skill (5) days \t$1300.00");
                        Console.Write("\nSelect a workshop: ");
                        int workshop = int.Parse(Console.ReadLine());
                        double lodgefee = 150;
                        double totalcost;
                        switch (workshop)
                        {
                            case 1:
                                {totalcost = (lodgefee * 3) + 1000;}
                                break;
                            case 2:
                                {totalcost = (lodgefee * 3) + 800;}
                                break;
                            case 3:
                                {totalcost = (lodgefee * 3) + 1500;}
                                break;
                            case 4:
                                {totalcost = (lodgefee * 5) + 1300;}
                                break;
                        default:
                                {totalcost = 0;}
                                break;
                        }
                        Console.WriteLine("\nTotal Cost: {0:c}", totalcost);
                    }
                    break;
                case 2:
                    {
                        Console.WriteLine("Workshop, Number of days and Reg fee: ");
                        Console.WriteLine("\t1. Handling Stress   (3) days \t$1000.00");
                        Console.WriteLine("\t2. Time Management   (3) days \t$800.00");
                        Console.WriteLine("\t3. Negotiation       (3) days \t$1500.00");
                        Console.WriteLine("\t4. Supervision skill (5) days \t$1300.00");
                        Console.Write("\nSelect a workshop: ");
                        int workshop = int.Parse(Console.ReadLine());
                        double lodgefee = 225;
                        double totalcost;
                        switch (workshop)
                        {
                            case 1:
                                { totalcost = (lodgefee * 3) + 1000; }
                                break;
                            case 2:
                                { totalcost = (lodgefee * 3) + 800; }
                                break;
                            case 3:
                                { totalcost = (lodgefee * 3) + 1500; }
                                break;
                            case 4:
                                { totalcost = (lodgefee * 5) + 1300; }
                                break;
                            default:
                                { totalcost = 0; }
                                break;
                        }
                        Console.WriteLine("\nTotal Cost: {0:c}", totalcost);
                    }
                    break;
                case 3:
                    {
                        Console.WriteLine("Workshop, Number of days and Reg fee: ");
                        Console.WriteLine("\t1. Handling Stress   (3) days \t$1000.00");
                        Console.WriteLine("\t2. Time Management   (3) days \t$800.00");
                        Console.WriteLine("\t3. Negotiation       (3) days \t$1500.00");
                        Console.WriteLine("\t4. Supervision skill (5) days \t$1300.00");
                        Console.Write("\nSelect a workshop: ");
                        int workshop = int.Parse(Console.ReadLine());
                        double lodgefee = 175;
                        double totalcost;
                        switch (workshop)
                        {
                            case 1:
                                { totalcost = (lodgefee * 3) + 1000; }
                                break;
                            case 2:
                                { totalcost = (lodgefee * 3) + 800; }
                                break;
                            case 3:
                                { totalcost = (lodgefee * 3) + 1500; }
                                break;
                            case 4:
                                { totalcost = (lodgefee * 5) + 1300; }
                                break;
                            default:
                                { totalcost = 0; }
                                break;
                        }
                        Console.WriteLine("\nTotal Cost: {0:c}", totalcost);
                    }
                    break;
                case 4:
                    {
                        Console.WriteLine("Workshop, Number of days and Reg fee: ");
                        Console.WriteLine("\t1. Handling Stress   (3) days \t$1000.00");
                        Console.WriteLine("\t2. Time Management   (3) days \t$800.00");
                        Console.WriteLine("\t3. Negotiation       (3) days \t$1500.00");
                        Console.WriteLine("\t4. Supervision skill (5) days \t$1300.00");
                        Console.Write("\nSelect a workshop: ");
                        int workshop = int.Parse(Console.ReadLine());
                        double lodgefee = 300;
                        double totalcost;
                        switch (workshop)
                        {
                            case 1:
                                { totalcost = (lodgefee * 3) + 1000; }
                                break;
                            case 2:
                                { totalcost = (lodgefee * 3) + 800; }
                                break;
                            case 3:
                                { totalcost = (lodgefee * 3) + 1500; }
                                break;
                            case 4:
                                { totalcost = (lodgefee * 5) + 1300; }
                                break;
                            default:
                                { totalcost = 0; }
                                break;
                        }
                        Console.WriteLine("\nTotal Cost: {0:c}", totalcost);
                    }
                    break;
                case 5:
                    {
                        Console.WriteLine("Workshop, Number of days and Reg fee: ");
                        Console.WriteLine("\t1. Handling Stress   (3) days \t$1000.00");
                        Console.WriteLine("\t2. Time Management   (3) days \t$800.00");
                        Console.WriteLine("\t3. Negotiation       (3) days \t$1500.00");
                        Console.WriteLine("\t4. Supervision skill (5) days \t$1300.00");
                        Console.Write("\nSelect a workshop: ");
                        int workshop = int.Parse(Console.ReadLine());
                        double lodgefee = 175;
                        double totalcost;
                        switch (workshop)
                        {
                            case 1:
                                { totalcost = (lodgefee * 3) + 1000; }
                                break;
                            case 2:
                                { totalcost = (lodgefee * 3) + 800; }
                                break;
                            case 3:
                                { totalcost = (lodgefee * 3) + 1500; }
                                break;
                            case 4:
                                { totalcost = (lodgefee * 5) + 1300; }
                                break;
                            default:
                                { totalcost = 0; }
                                break;
                        }
                        Console.WriteLine("\nTotal Cost: {0:c}", totalcost);
                    }
                    break;
                case 6:
                    {
                        Console.WriteLine("Workshop, Number of days and Reg fee: ");
                        Console.WriteLine("\t1. Handling Stress   (3) days \t$1000.00");
                        Console.WriteLine("\t2. Time Management   (3) days \t$800.00");
                        Console.WriteLine("\t3. Negotiation       (3) days \t$1500.00");
                        Console.WriteLine("\t4. Supervision skill (5) days \t$1300.00");
                        Console.Write("\nSelect a workshop: ");
                        int workshop = int.Parse(Console.ReadLine());
                        double lodgefee = 150;
                        double totalcost;
                        switch (workshop)
                        {
                            case 1:
                                { totalcost = (lodgefee * 3) + 1000; }
                                break;
                            case 2:
                                { totalcost = (lodgefee * 3) + 800; }
                                break;
                            case 3:
                                { totalcost = (lodgefee * 3) + 1500; }
                                break;
                            case 4:
                                { totalcost = (lodgefee * 5) + 1300; }
                                break;
                            default:
                                { totalcost = 0; }
                                break;
                        }
                        Console.WriteLine("\nTotal Cost: {0:c}", totalcost);
                    }
                    break;
                default:
                    {
                        Console.WriteLine("Sorry, Invalid selection");
                    }
                    break;
            }
            Console.ReadLine();
            Console.Clear();
            goto repeat;
        }
    }
}

No comments:

Post a Comment