please help run this program in 3 times\cases. 
**case 1:** it will only display the following:
Employee Name:
Employee Code:
Salary Level:
Salary Rate:
**case 2:** 
Employee Name:
Employee Code:
Salary Level:
Salary Rate:
-------------
Date Covered:
Total Number of Work Hours: 
Overtime hours: 
Regular Income:
Overtime income: 
Gross income: 
**and case 3:**
Employee Name:
Employee Code:
Salary Level:
Salary Rate:
-------------
Date Covered:
Total Number of Work Hours: 
Overtime hours: 
Regular Income:
Overtime income: 
Gross income: 
Deductions:
- here is my code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;

    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                string employeecode;


                if (File.Exists("employee.txt"))
                {
                    Console.Write("Employee Code: ");
                    employeecode = Console.ReadLine();



                    foreach (string readfile in File.ReadAllLines("employee.txt"))
                    {
                        string[] parts = readfile.Split(',', '_', ';');
                        string[] days = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" };
                        int[] count = new int[5];
                        int[] hourlyrate = new int[5];
                        int[] count1 = new int[5];


                        if (parts[0].Contains(employeecode))
                        {
                            Console.WriteLine("");
                            Console.WriteLine("Employee Name: " + parts[1] + " " + parts[2]);
                            Console.WriteLine("Employee Code: " + employeecode);
                            Console.WriteLine("Salary Level: " + parts[3]);

                            if (parts[3] == "1")
                            {
                                Console.WriteLine("Salary Rate: Php 380.00/day");
                            }
                            if (parts[3] == "2")
                            {
                                Console.WriteLine("Salary Rate: Php 450.00/day");
                            }
                            if (parts[3] == "3")
                            {
                                Console.WriteLine("Salary Rate: Php 550.00/day");
                            }
                            Console.Write(Environment.NewLine);

                            File.AppendAllText("dtr.txt", employeecode + ",");


                            for (int i = 0; i < 5; i++)
                            {
                                Console.Write("*********************************" + Environment.NewLine);
                                Console.Write("Enter Time-in for " + days[i] + ": ");
                                string timeIn = Console.ReadLine();
                                Console.Write("Enter Time-Out for " + days[i] + ": ");
                                string timeOut = Console.ReadLine();

                                Console.Write("Is " + days[i] + " a holiday? [YES/NO]: ");
                                string holiday = Console.ReadLine();

                                if (holiday == "YES" || holiday == "Yes")
                                {
                                    Console.Write("Enter the holiday time-in for " + days[i] + ": ");
                                    string overtimeIn = Console.ReadLine();
                                    Console.Write("Enter the holiday time-out for " + days[i] + ": ");
                                    string overtimeOut = Console.ReadLine();

                                }
                                else if (holiday == "NO" || holiday == "No")
                                {

                                    Console.Write("Enter the overtime-in for " + days[i] + ": ");
                                    string overtimeIn = Console.ReadLine();
                                    Console.Write("Enter the overtime-out for " + days[i] + ": ");
                                    string overtimeOut = Console.ReadLine();

                                    File.AppendAllText("dtr.txt", overtimeIn + "-" + overtimeOut + "-");

                                    string[] splitIn = overtimeIn.Split(':');
                                    string[] splitOut = overtimeOut.Split(':');

                                    int Hours1 = Convert.ToInt32(splitOut[0]) - Convert.ToInt32(splitIn[0]);

                                    count1[i] = Hours1;
                                }


                                File.AppendAllText("dtr.txt", timeIn + "-" + timeOut + "-");

                                string[] splitin = timeIn.Split(':');
                                string[] splitout = timeOut.Split(':');

                                int Hours = Convert.ToInt32(splitout[0]) - Convert.ToInt32(splitin[0]);

                                count[i] = Hours - 1;

                            }
                            Console.WriteLine("");
                            Console.Write("Enter Coverage Date of this payroll: ");
                            string coverdate = Console.ReadLine();

                            Console.Write(Environment.NewLine);
                            Console.Write("*********************************" + Environment.NewLine);
                            Console.WriteLine("Date Covered: " + coverdate);
                            Console.WriteLine("Total Number of Work Hours: " + (count.Sum()) + " hours");
                            Console.WriteLine("Overtime hours: " + count1.Sum() + " hours");

                            if (parts[3] == "1")
                            {
                                double income1 = (380.00 / 8) * (count.Sum());
                                double overtime1 = ((380.00 / 8) * 1.1) * count1.Sum();
                                double grossincome1 = (income1 + overtime1);
                                double netincome1 = ((grossincome1 - 214.70) - 21.47);
                                Console.WriteLine("Regular Income: Php " + String.Format("{0:0.00}", income1));
                                Console.WriteLine("Overtime Income: Php " + String.Format("{0:0.00}", overtime1));
                                Console.WriteLine("Gross Income: Php " + String.Format("{0:0.00}", grossincome1));
                                Console.WriteLine("Deductions:" + Environment.NewLine + "* Tax: Php 214.70" + Environment.NewLine + "* SSS: Php 21.47");
                                Console.WriteLine("Net Income: Php " + netincome1);
                            }
                            if (parts[3] == "2")
                            {
                                double income2 = (450.00 / 8) * (count.Sum());
                                double overtime2 = ((450.00 / 8) * 1.1) * count1.Sum();
                                double grossincome2 = (income2 + overtime2);
                                double netincome2 = ((grossincome2 - 214.70) - 21.47);
                                Console.WriteLine("Regular Income: Php " + String.Format("{0:0.00}", income2));
                                Console.WriteLine("Overtime Income: Php " + String.Format("{0:0.00}", overtime2));
                                Console.WriteLine("Gross Income: Php " + String.Format("{0:0.00}", grossincome2));
                                Console.WriteLine("Deductions:" + Environment.NewLine + "* Tax: Php 214.70" + Environment.NewLine + "* SSS: Php 21.47");
                                Console.WriteLine("Net Income: Php " + netincome2);
                            }
                            if (parts[3] == "3")
                            {
                                double income3 = (550.00 / 8) * (count.Sum());
                                double overtime3 = ((550.00 / 8) * 1.1) * count1.Sum();
                                double grossincome3 = (income3 + overtime3);
                                double netincome3 = ((grossincome3 - 214.70) - 21.47);
                                Console.WriteLine("Regular Income: Php " + String.Format("{0:0.00}", income3));
                                Console.WriteLine("Overtime Income: Php " + String.Format("{0:0.00}", overtime3));
                                Console.WriteLine("Gross Income: Php " + String.Format("{0:0.00}", grossincome3));
                                Console.WriteLine("Deductions:" + Environment.NewLine + "* Tax: Php 214.70" + Environment.NewLine + "* SSS: Php 21.47");
                                Console.WriteLine("Net Income: Php " + netincome3);
                            }

                        }



                        else
                            if (parts.Contains(employeecode))
                            {
                                Console.Write(Environment.NewLine);

                                Console.WriteLine("Employee Name: " + parts[0] + " " + parts[1]);
                                Console.WriteLine("Employee Code: " + employeecode);
                                Console.WriteLine("Salary Level: " + parts[3]);

                                if (parts[3] == "1")
                                {
                                    Console.WriteLine("Salary Rate: Php 380.00/day");
                                }
                                if (parts[3] == "2")
                                {
                                    Console.WriteLine("Salary Rate: Php 450.00/day");
                                }
                                if (parts[3] == "3")
                                {
                                    Console.WriteLine("Salary Rate: Php 550.00/day");
                                }
                                Console.Write(Environment.NewLine);

                                File.AppendAllText("dtr.txt", employeecode + ",");


                                for (int i = 0; i < 5; i++)
                                {
                                    Console.Write("*********************************" + Environment.NewLine);
                                    Console.Write("Enter Time-in for " + days[i] + ": ");
                                    string timeIn = Console.ReadLine();
                                    Console.Write("Enter Time-Out for " + days[i] + ": ");
                                    string timeOut = Console.ReadLine();

                                    Console.Write("Is " + days[i] + " a holiday? [YES/NO]: ");
                                    string holiday = Console.ReadLine();

                                    if (holiday == "YES" || holiday == "Yes")
                                    {
                                        Console.Write("Enter the holiday time-in for " + days[i] + ": ");
                                        string overtimeIn = Console.ReadLine();
                                        Console.Write("Enter the holiday time-out for " + days[i] + ": ");
                                        string overtimeOut = Console.ReadLine();

                                    }
                                    else if (holiday == "NO" || holiday == "No")
                                    {

                                        Console.Write("Enter the overtime-in for " + days[i] + ": ");
                                        string overtimeIn = Console.ReadLine();
                                        Console.Write("Enter the overtime-out for " + days[i] + ": ");
                                        string overtimeOut = Console.ReadLine();

                                        File.AppendAllText("dtr.txt", overtimeIn + "-" + overtimeOut + "-");

                                        string[] splitIn = overtimeIn.Split(':');
                                        string[] splitOut = overtimeOut.Split(':');

                                        int Hours1 = Convert.ToInt32(splitOut[0]) - Convert.ToInt32(splitIn[0]);

                                        count1[i] = Hours1;
                                    }


                                    File.AppendAllText("dtr.txt", timeIn + "-" + timeOut + "-");

                                    string[] splitin = timeIn.Split(':');
                                    string[] splitout = timeOut.Split(':');

                                    int Hours = Convert.ToInt32(splitout[0]) - Convert.ToInt32(splitin[0]);

                                    count[i] = Hours - 1;

                                }
                                Console.WriteLine("");
                                Console.Write("Enter Coverage Date of this payroll: ");
                                string coverdate = Console.ReadLine();

                                Console.Write(Environment.NewLine);
                                Console.Write("*********************************" + Environment.NewLine);
                                Console.WriteLine("Date Covered: " + coverdate);
                                Console.WriteLine("Total Number of Work Hours: " + (count.Sum()) + " hours");
                                Console.WriteLine("Overtime hours: " + count1.Sum() + " hours");

                                if (parts[3] == "1")
                                {
                                    double income1 = (380.00 / 8) * (count.Sum());
                                    double overtime1 = ((380.00 / 8) * 1.1) * count1.Sum();
                                    double grossincome1 = (income1 + overtime1);
                                    double netincome1 = ((grossincome1 - 214.70) - 21.47);
                                    Console.WriteLine("Regular Income: Php " + String.Format("{0:0.00}", income1));
                                    Console.WriteLine("Overtime Income: Php " + String.Format("{0:0.00}", overtime1));
                                    Console.WriteLine("Gross Income: Php " + String.Format("{0:0.00}", grossincome1));
                                    Console.WriteLine("Deductions:" + Environment.NewLine + "* Tax: Php 214.70" + Environment.NewLine + "* SSS: Php 21.47");
                                    Console.WriteLine("Net Income: Php " + netincome1);
                                }
                                if (parts[3] == "2")
                                {
                                    double income2 = (450.00 / 8) * (count.Sum());
                                    double overtime2 = ((450.00 / 8) * 1.1) * count1.Sum();
                                    double grossincome2 = (income2 + overtime2);
                                    double netincome2 = ((grossincome2 - 214.70) - 21.47);
                                    Console.WriteLine("Regular Income: Php " + String.Format("{0:0.00}", income2));
                                    Console.WriteLine("Overtime Income: Php " + String.Format("{0:0.00}", overtime2));
                                    Console.WriteLine("Gross Income: Php " + String.Format("{0:0.00}", grossincome2));
                                    Console.WriteLine("Deductions:" + Environment.NewLine + "* Tax: Php 214.70" + Environment.NewLine + "* SSS: Php 21.47");
                                    Console.WriteLine("Net Income: Php " + netincome2);
                                }
                                if (parts[3] == "3")
                                {
                                    double income3 = (550.00 / 8) * (count.Sum());
                                    double overtime3 = ((550.00 / 8) * 1.1) * count1.Sum();
                                    double grossincome3 = (income3 + overtime3);
                                    double netincome3 = ((grossincome3 - 214.70) - 21.47);
                                    Console.WriteLine("Regular Income: Php " + String.Format("{0:0.00}", income3));
                                    Console.WriteLine("Overtime Income: Php " + String.Format("{0:0.00}", overtime3));
                                    Console.WriteLine("Gross Income: Php " + String.Format("{0:0.00}", grossincome3));
                                    Console.WriteLine("Deductions:" + Environment.NewLine + "* Tax: Php 214.70" + Environment.NewLine + "* SSS: Php 21.47");
                                    Console.WriteLine("Net Income: Php " + netincome3);
                                }


                            }

                    }

                    Console.ReadLine();
                }
            }
        }

    }




thanks in advance

Recommended Answers

All 2 Replies

What is it doing wrong?

And what is the format of parts[]? Without that we don't even know which code branch is being hit.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.