okay so i have to make a windows form app in c# for a car catalog company as an assignment for school. i was about half way done, and i simply dont have time. i could email you my half done app if you would like. i have all the code from writing the console app earlier in the class, so if you could help i would greatly appreciate it. i could definitely reimburse you if you message me. thank you so much. code posted below.

here are the requirements:

The Windows Application will allow the user to:

1. Add a car to the inventory

2. List the cars in the inventory

3. List the cars by price

4. List the cars by year

5. Search for a car by make

6. Search for a car by model

7. Search for a car by year

8. Delete a car from the inventory

The program should allow the user to enter an unlimited number of cars.

LIST

When doing a list:

Year, Make, Model, Price and Total Inventory in Dollars must be displayed

1. Does it build without errors? +10
2. Does the code contain multiple classes, properties and methods? +15
3. Does the methods contain error handling? +20
4. Does the UI look organized and good (controls lined up, not a lot of colors)? +25
5. Does the code use LINQ? +10
6. Does the code contain comments? +10
7. Does the program flow make sense? +15


here is the code:

class Program
    {

        static int indx = 0;

        static Car[] Catelog = new Car[20];

        static void Main(string[] args)
        {

            string command = string.Empty;

            while (command != "6")
            {

                Console.WriteLine("Enter the number of the command you want: ");

                Console.WriteLine("1. Add ");

                Console.WriteLine("2. List ");

                Console.WriteLine("3. List By Price ");

                Console.WriteLine("4. List By Year ");

                Console.WriteLine("5. Search By Make");

                Console.WriteLine("6. Quit ");

                command = Console.ReadLine();

                switch (command)
                {

                    case "1":
                        {

                            Console.Write("Year: ");

                            string year = Console.ReadLine();

                            Console.Write("Make: ");

                            string make = Console.ReadLine();

                            Console.Write("Model: ");

                            string model = Console.ReadLine();

                            Console.Write("Price: ");

                            string price = Console.ReadLine();

                            Add(year, make, model, Convert.ToInt32(price));

                            break;

                        }

                    case "2":
                        {

                            List();

                            break;

                        }

                    case "3":
                        {
                            
                            ListByPrice();

                            break;

                        }
                    case "4":
                        {

                            //ListByYear();

                            break;

                        }
                    case "5":
                        {
                            Console.Write("Make: ");

                            string make = Console.ReadLine();

                            Search(make);

                            break;

                        }

                    case "6":

                        break;



                }

            }

        }

        private static void Search(string make)
        {
            for (int i = 0; i <= Catelog.Length - 1; i++) 
            {
                if (Catelog[i].Make.ToLower() == make.ToLower())
                {
                    Console.Write("{0}\t", Catelog[i].Year);

                    Console.Write("{0}\t", Catelog[i].Make);

                    Console.Write("{0}\t", Catelog[i].Model);

                    Console.Write("{0}", Catelog[i].Price);

                    Console.WriteLine("");
                    break;
                }
            }

        }

        public static void ListByYear()
        {
            Array.Sort(Catelog, (IComparer)new Car.SortByYearClass());

             Console.WriteLine("Year    Make    Model   Price");

           Console.WriteLine("=======================================================");

            for (int i = 0; i <= Catelog.Length - 1; i++)
            {

                if (Catelog[i] != null)
                {
                    Console.Write("{0}\t", Catelog[i].Year);

                    Console.Write("{0}\t", Catelog[i].Make);

                    Console.Write("{0}\t", Catelog[i].Model);

                    Console.Write("{0}", Catelog[i].Price);

                    Console.WriteLine("");

                }
            }
        }



        public static void Add(string year, string make, string model, double price)
        {

            Catelog[indx] = new Car(year, make, model, price);

            indx++;

        }



        public static void List()
        {
            Console.WriteLine("Year    Make    Model   Price");

            Console.WriteLine("=======================================================");

            for (int i = 0; i <= Catelog.Length - 1; i++)
            {

                if (Catelog[i] != null)
                {
                    Console.Write("{0}\t", Catelog[i].Year);

                    Console.Write("{0}\t", Catelog[i].Make);

                    Console.Write("{0}\t", Catelog[i].Model);

                    Console.Write("{0}", Catelog[i].Price);

                    Console.WriteLine("");
                }
            }

        }

        public static void ListByPrice()
        {
            Array.Sort(Catelog);

            Console.WriteLine("Year    Make    Model   Price");

            Console.WriteLine("=======================================================");
            
            for (int i = 0; i <= Catelog.Length - 1; i++)
            {

                if (Catelog[i] != null)
                {
                    Console.Write("{0}\t", Catelog[i].Year);

                    Console.Write("{0}\t", Catelog[i].Make);

                    Console.Write("{0}\t", Catelog[i].Model);

                    Console.Write("{0}", Catelog[i].Price);

                    Console.WriteLine("");

                }

            }

        }

    }

    public class Car : IComparable
    {
        public string sortby;

        private string _make;

        private string _model;

        private double _price;

        private string _year;

        public Car(string year, string make, string model, double price)
        {

            Year = year;

            Make = make;

            Model = model;

            Price = price;

        }

        public string Make
        {

            get
            {

                return _make;

            }

            set
            {

                _make = value;

            }

        }

        public string Model
        {

            get
            {

                return _model;

            }

            set
            {

                _model = value;

            }

        }

        public double Price
        {

            get
            {

                return _price;

            }

            set
            {

                _price = value;

            }

        }

        public string Year
        {

            get
            {

                return _year;

            }

            set
            {

                _year = value;

            }

        }

        int IComparable.CompareTo(Object c)
        {
            Car o = (Car)c;

             int retval = this.Price.CompareTo(o.Price);


            if (retval != 0)
            {
                return retval;
            }
            else
            {
               return this.Price.CompareTo(o.Price);
            }

        }

        public class SortByYearClass : IComparer
        {
            public int Compare(object obj1, object obj2)
            {
                Car car1 = (Car)obj1;
                Car car2 = (Car)obj2;

                return (String.Compare(car1.Year, car2.Year));
            }
        }

    }
}

Recommended Answers

All 6 Replies

i was about half way done, and i simply dont have time.

HUH!!!
You should read the rules of this site.
You should place posted code between CODE tags.
But I guess you don't have time to do all that.
Tell me honestly, why should I spend time, besides the tremendous effort of writing this post, to solve your issue?

commented: That's true! +14

100 dollars? seriously. message me

He is going to some Informatics school
He has no other obligations (but I mean real obligations, not some strange sport activity)
And he has no time for HIS school project which should be on 1st place of all orders.

Strange is this world today! But it sure wasn`t in my times (when I was back in the school).

NOTE: we are not here to support your laziness and doing your school/home work!
And $100 is not enough. I will do it for $500.
Take it or leave it :)

can u show me because i know very well

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.