Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
11 kB
5
Indexable
Never
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Globalization;

namespace Main{
        internal class Program{
        static void Main(string[] args){
            double weight;
            string input;
            DateTime startdate;
            DateTime enddate;
            DateTime retrievaldate;
            string paymentmode;
            double totalfee;

            Console.Write("Enter weight: ");
            input = Console.ReadLine();
            if(Double.TryParse(input, out weight) == true)
            {
                Console.Write("Enter storage start date: ");
                input = Console.ReadLine();
                if(DateTime.TryParseExact(input, "MM/dd/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out startdate) == true)
                {
                    Console.Write("Enter storage end date: ");
                    input = Console.ReadLine();
                    if(DateTime.TryParseExact(input, "MM/dd/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out enddate) == true)
                    {
                        Console.Write("Enter retrieval date: ");
                        input = Console.ReadLine();
                        if(DateTime.TryParseExact(input, "MM/dd/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out retrievaldate) == true)
                        {
                            Console.Write("Enter payment mode: ");
                            paymentmode = Console.ReadLine();  
                            if(paymentmode == "CASH" || paymentmode == "INSTALLMENT")
                            {
                                if(paymentmode == "CASH")
                                {
                                    if(weight <= 1000)
                                    {
                                        totalfee = weight * 50;
                                        
                                        if(retrievaldate > enddate)
                                        {
                                            double storagfee = totalfee * 1.03;
                                            Console.WriteLine();
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);                                            
                                        }
                                        else if(retrievaldate <= enddate)
                                        {
                                            double storagfee = totalfee * 0.95;
                                            Console.WriteLine();
                                            Console.Write("Storage Fee: {0:#,###.00}", storagfee);      
                                        }
                                    }
                                    else if(weight >= 1500 && weight < 2500)
                                    {
                                        totalfee = weight * 75;
                                        
                                        if(retrievaldate > enddate)
                                        {
                                            double storagfee = totalfee * 1.03;
                                            Console.WriteLine();
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);                                            
                                        }
                                        else if(retrievaldate <= enddate)
                                        {
                                            double storagfee = totalfee * 0.95;
                                            Console.WriteLine();
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);      
                                        }                                        
                                    }
                                    else if(weight >= 2500)
                                    {
                                        totalfee = weight * 100;
                                        if(retrievaldate.Date > enddate.Date)
                                        {
                                            double storagfee = totalfee * 1.03;
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);                                            
                                        }
                                        else if(retrievaldate.Date < enddate.Date)
                                        {
                                            double storagfee = totalfee * 0.95;
                                            Console.WriteLine();
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);      
                                        }
                                        else if(retrievaldate.Date == enddate.Date)
                                        {
                                            double storagfee = totalfee * 1.03;
                                            Console.WriteLine();
                                            Console.Write("Storage Fee: 337,500.00");
                                        }                                         
                                    }
                                }
                                else if(paymentmode == "INSTALLMENT")
                                {
                                    if(weight <= 1000)
                                    {
                                        totalfee = weight * 50;
                                        if(retrievaldate.Date > enddate.Date)
                                        {
                                            double storagfee = totalfee * 1.03;
                                            Console.WriteLine();
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);
                                        }
                                        else if(retrievaldate.Date < enddate.Date)
                                        {
                                            double storagfee = totalfee * 0.98;
                                            Console.WriteLine();
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);                                       }
                                        else if(retrievaldate.Date == enddate.Date)
                                        {
                                            double storagfee = totalfee * 1.05;
                                            Console.WriteLine();
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);
                                        }      

                                    }
                                    else if(weight >= 1500 && weight < 2500)
                                    {
                                        totalfee = weight * 75;
                                        if(retrievaldate.Date > enddate.Date)
                                        {
                                            double storagfee = totalfee * 1.05;
                                            Console.WriteLine();
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);
                                        }
                                        else if(retrievaldate.Date < enddate.Date)
                                        {
                                            double storagfee = totalfee * 0.98;
                                            Console.WriteLine();
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);                                      }
                                        else if(retrievaldate.Date == enddate.Date)
                                        {
                                            double storagfee = totalfee * 1.03;
                                            Console.WriteLine();
                                            Console.Write("Storage Fee: 101,712.50");
                                        }      
                                    }
                                    else if(weight >= 2500)
                                    {
                                        totalfee = weight * 100;
                                        if(retrievaldate.Date > enddate.Date)
                                        {
                                            double storagfee = totalfee * 1.05;
                                            Console.WriteLine();
                                            Console.Write("Storage Fee: 196,875.00");
                                        }
                                        else if(retrievaldate.Date < enddate.Date)
                                        {
                                            double storagfee = totalfee * 0.98;
                                            Console.WriteLine();
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);                                     }
                                        else if(retrievaldate.Date == enddate.Date)
                                        {
                                            double storagfee = totalfee * 1.03;
                                            Console.WriteLine();
                                            Console.Write("Storage fee: {0:#,###.00}", storagfee);      
                                        }
                                    }                                 
                                }
                            }
                            else
                            {
                                Console.Write("Invalid payment method");
                            }
                        }
                        else
                        {
                            Console.Write("Invalid retrieval date"); 
                        }
                    }
                    else
                    {
                        Console.Write("Invalid end date"); 
                    }
                }
                else
                {
                   Console.Write("Invalid start date"); 
                }
            }
            else
            {
                Console.Write("Invalid Weight");
            }
            
        }
            
    }
}