Описание
Сценарий:
Преподаватель объяснил своим ученикам концепцию различных типов переменных в C# и дал им задание для реализации. программа, демонстрирующая использование этих переменных. Программа должна включать объявления переменных, инициализацию и выполнение операций.
Помогите им выполнить задачу, используя свои навыки программирования на C#.
Functionalities:
In class Movie, implement the below-given static variable.
**Data Type | Variable Name**
**`string | name`**
In class Movie, implement the below-given Instance variables.
**Data Type | Variable Name**
**`int | ticketId`**
**`string | seatNumber`**
implement the below given method also,
Method
Description
**public Movie ReturnMovieDetails(string name, int ticketId, string seatNumber)**
This method is used to set movie details such as name, ticketId and seatNumber (Local Variables) to the movie object and return it.
In this method, create a movie object(Reference Variable) and assign the values, then return it.
In Program class - Main method,
1.Get the values from the user as per the Sample Input.
2.Call the above method and display the result as per the Sample Output.
Note:
Keep the variables, methods and classes as public.
Please read the method rules clearly.
Do not use Environment.Exit() to terminate the program.
Do not change the given code template.
Summary :
Through working on this task, they have learned about different types of variables in C#.
A static variable in C# is a class-level variable that is shared among all instances and retains its value throughout the program's execution.
An instance variable in C# is a non-static variable that belongs to a specific instance of a class and holds unique values for each instance.
A reference variable in C# is a variable that holds the memory address of an object rather than the actual object itself.
A local variable in C# is a variable that is declared and used within a specific block or method scope.
> Sample Input:
>
> Enter the movie name
>
> Avatar
>
> Enter the ticket id
>
> 101
>
> Enter the seat number
>
> A5
>
> Sample Output:
>
> Movie name : Avatar
>
> Ticket id : 101
>
> Seat number : A5
[For Program.Cs][1]
[For Main.Cs][2]
[For The Error I am Getiing][3]
[1]: https://i.sstatic.net/mLmjSqZD.png
[2]: https://i.sstatic.net/B9lNkizu.png
[3]: https://i.sstatic.net/trAq91jy.png
Подробнее здесь: https://stackoverflow.com/questions/790 ... -its-accen