Parking lot C#

Joined
Nov 5, 2020
Messages
1
Reaction score
0
Hello!

I’m stocked in a project which I don’t know how to solve.

The parking lot with space for 100 vehicles( cars and motorcycles.)

At present, all vehicles are picked up before 23:59 when the parking closes. Uncollected vehicles are driven to a parking lot outside the city and customers will have to pay a penalty to get their vehicle out.

I want:

1.The system must be able to receive a vehicle and tell which parking space it should be driven to.
2.Manually move a vehicle from one location to another and remove vehicles when picking up.
3.Identify vehicles by registration number which max length its 10 characters.

4. Parking box may contain
1 car or 1 motorbike or 2 motorbikes or be empty.

5.The parking boxes shall be treated as a one-dimensional vector (array) of strings. The vector shall handle 100 elements. The customer's staff are people and expect seats to be numbered 1-100 in inputs and outputs in the system.


Here What I coded. How should I do?

Code:
using System;

namespace Parking_in_Prague
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] vechicleType = new string[2];
            string[] parkingSpace = new string[100];

            Header();

            foreach (string regplate in regPlate)
            {
                Console.WriteLine(regplate);
            }


            Console.WriteLine("What would you do?:");
            Console.WriteLine("1.Park Vehicle | 2. Move a Vehicle | 3.Remove Vehicle | 4. Search for vehicle");
            int option = Int32.Parse(Console.ReadLine());

            switch (option)
            {
                case 1:
                    ParkVehicle();
                    break;

                case 2:
                    MoveVehicle();
                    break;

                case 3:
                    RemoveVehicle();
                    break;

                case 4:
                    SearchVehicle();
                    break;

            }
            Console.WriteLine(regPlate);

        }
        static public string[] regPlate;

        static public void ParkVehicle();
    }
    regPlate = new string [100];
    int i;
    Console.Clear();
    Console.WriteLine("What kind of vehicle do you have?");
    Console.WriteLine("1. Car | 2. Motorbike");
    int optionVehicle = Int32.Parse(Console.ReadLine());


    if (optionVehicle ==1)
}
Console.Write("Registration number: ");

for (if = 0; i < regPlate.Length,int++)
    {

    regPlate = Console.ReadLine();
    Console.WriteLine(regPlate);
}

}

Thank you very much in advance anyone who wants to give feedback and thoughts how to code this.

Regards,
Flava
 
Last edited by a moderator:
Joined
Oct 7, 2021
Messages
3
Reaction score
0
Hello!

I’m stocked in a project which I don’t know how to solve.

The parking lot with space for 100 vehicles( cars and motorcycles.)

At present, all vehicles are picked up before 23:59 when the parking closes. Uncollected vehicles are driven to a parking lot outside the city and customers will have to pay a penalty to get their vehicle out.

I want:

1.The system must be able to receive a vehicle and tell which parking space it should be driven to.
2.Manually move a vehicle from one location to another and remove vehicles when picking up.
3.Identify vehicles by registration number which max length its 10 characters.

4. Parking box may contain
1 car or 1 motorbike or 2 motorbikes or be empty.

5.The parking boxes shall be treated as a one-dimensional vector (array) of strings. The vector shall handle 100 elements. The customer's staff are people and expect seats to be numbered 1-100 in inputs and outputs in the system.


Here What I coded. How should I do?

Code:
using System;

namespace Parking_in_Prague
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] vechicleType = new string[2];
            string[] parkingSpace = new string[100];

            Header();

            foreach (string regplate in regPlate)
            {
                Console.WriteLine(regplate);
            }


            Console.WriteLine("What would you do?:");
            Console.WriteLine("1.Park Vehicle | 2. Move a Vehicle | 3.Remove Vehicle | 4. Search for vehicle");
            int option = Int32.Parse(Console.ReadLine());

            switch (option)
            {
                case 1:
                    ParkVehicle();
                    break;

                case 2:
                    MoveVehicle();
                    break;

                case 3:
                    RemoveVehicle();
                    break;

                case 4:
                    SearchVehicle();
                    break;

            }
            Console.WriteLine(regPlate);

        }
        static public string[] regPlate;

        static public void ParkVehicle();
    }
    regPlate = new string [100];
    int i;
    Console.Clear();
    Console.WriteLine("What kind of vehicle do you have?");
    Console.WriteLine("1. Car | 2. Motorbike");
    int optionVehicle = Int32.Parse(Console.ReadLine());


    if (optionVehicle ==1)
}
Console.Write("Registration number: ");

for (if = 0; i < regPlate.Length,int++)
    {

    regPlate = Console.ReadLine();
    Console.WriteLine(regPlate);
}

}

Thank you very much in advance anyone who wants to give feedback and thoughts how to code this.

Regards,
Flava
 
Joined
Oct 7, 2021
Messages
3
Reaction score
0
Hi!

I have the same task. Can I see how you solved the task?

Thanks!
Best regards
Dan
 
Joined
Mar 3, 2021
Messages
241
Reaction score
30
Show us what you've got so far or what you're thinking and we can work from there. The assignment forces you to use a one dimensional string array, so there's only so many ways you can do it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top