0% found this document useful (0 votes)
9 views6 pages

DAM Assigment 1 Simple

The document outlines the steps to create a mobile application using Xamarin Android, featuring buttons, two object classes (Student and Person), and two pages. It includes instructions for setting up the project in Visual Studio, creating classes, and displaying object details in text views. The code examples demonstrate the implementation of the Student and Person classes, along with methods for displaying their details.

Uploaded by

liviucalistru95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

DAM Assigment 1 Simple

The document outlines the steps to create a mobile application using Xamarin Android, featuring buttons, two object classes (Student and Person), and two pages. It includes instructions for setting up the project in Visual Studio, creating classes, and displaying object details in text views. The code examples demonstrate the implementation of the Student and Person classes, along with methods for displaying their details.

Uploaded by

liviucalistru95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

DAM Assigment 1-Simple

Realizarea aplicatiei mobile Xamarin Android in care are componente


de tip buton ,2 clase de obiecte si 2 pagini (view-uri sau
activitati).Afisarea datelor celor 2 obiecte in component de tip
textview sau lista.
Pasii in realizarea aplicatiei :
1)Deschidem Visual Studio si crearea unui nou proiect MAUI sau
Xamarin .
In cazul de fata selectam Android Aplication si deschidem o noua
pagina in care vom introduce codurile si selectarea marca
Emulatorului

Se creează noua configuraţie a proiectului si se deschide o noua


pagină.
2)Se deschide programul Visual Studio si seteaza emulatorul (Tipul
dispozitivului )
3)Se creeaza cele 2 clase de obiecte
1)clasa Student
public class Student
{
public string Name { get; set; }
public int Age { get; set; }

public Student(string name, int age)


{
Name = name;
Age = age;
}
}
Clasa Person
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
public int Age { get; set; }

public Person(int id, string name, int age)


{
Id = id;
Name = name;
Age = age;
}

public void PrintDetails()


{
Console.WriteLine($"Id: {Id}, Name: {Name}, Age: {Age}");
}
}
Pe fiecare pagina ,adaugarea cate un textView pentru a afisa detaliile
obiectului respectiv.
Adaugarea fiecarei pagini unui buton ce va permite Utilizatorului sa
treaca de la Clasa Person la clasa Student .

using System;
class Program
{
static void Main()
{
Student student1 = new( "John", 20);
Student student = student1;
Person person = new Person(1, "Alice", 25);

student.Name = "Bob";
person.Age = 30;

Console.WriteLine($"Student - Name: {student.Name}, Age: {student.Age}");


person.DisplayDetails();
}
}
class Person
{
public int Id { get; set; }
public string Name { get; set; }
public int Age { get; set; }

public Person(int id, string name, int age)


{
Id = id;
Name = name;
Age = age;
}

public void DisplayDetails()


{
Console.WriteLine($"Person - Name: {Name}, Age: {Age}");
}
}

class Student : Person


{
public Student(
string name,
int age) : base(0, name, age)
{
}

You might also like