17# Object Methods Object Oriented Programming
17# Object Methods Object Oriented Programming
/////////////////
//Character.cs//
//\\\\\\\\\\\\\\
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace darklter
{
internal class Character
{
public string name, dialog;
public int hp, mp, lvl;
public Character(string name, string dialog, int hp, int mp, int lvl)
{
this.name = name;
this.dialog = dialog;
this.hp = hp;
this.mp = mp;
this.lvl = lvl;
}
///////////////
//Program.cs//
//\\\\\\\\\\\\
using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
Character c = new Character("David", "Hello World", 100, 50, 1);
c.introduce();
c.sayDialog();
}
}
}
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||
/////////////////
//Character.cs//
//\\\\\\\\\\\\\\
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace darklter
{
internal class Character
{
public string name, dialog;
public int hp, mp, lvl;
public Character(string name, string dialog, int hp, int mp, int lvl)
{
this.name = name;
this.dialog = dialog;
this.hp = hp;
this.mp = mp;
this.lvl = lvl;
}
///////////////
//Program.cs//
//\\\\\\\\\\\\
using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
Character c = new Character("David", "Hello World", 100, 50, 1);
c.checkStats();
}
}
}
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||
/////////////////
// Student.cs //
//\\\\\\\\\\\\\\
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace darklter
{
internal class Student
{
public string firstName, lastName;
public string course, year, section;
public float midtermGrade, finalGrade;
///////////////
//Program.cs//
//\\\\\\\\\\\\
using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
Student s1 = new Student("David", "Sdpt", "BSIT", "2", "E", 90, 90);
s1.introduceSelf();
s1.evaluateGrade();
Console.WriteLine();