c#/수업 과제

골리앗

yeeendy 2023. 1. 4. 22:46

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace study02
{
    internal class Goliath
    {
        public int hp;
        public float moveSpeed;
        //생성자
        public Goliath()
        {

        }
        public void Stop()
        {
            Console.WriteLine("골리앗이 정지했습니다.");
        }
        public void Move()
        {
            Console.WriteLine("골리앗이 이동했습니다.");
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace study02
{
    internal class App
    {
        //생성자
        public App() 
        {
            Goliath goliath = new Goliath();

            goliath.hp = 125;
            goliath.moveSpeed = 2.2f;
            
            Console.WriteLine("생명력: {0}", goliath.hp);
            Console.WriteLine("이동속도: {0}", goliath.moveSpeed);

            goliath.Stop();
            goliath.Move();

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace study02
{
    internal class Program
    {
        static void Main(string[] args)
        {
            new App();
        }
    }
}

'c# > 수업 과제' 카테고리의 다른 글

Chimu  (0) 2023.01.05
질럿  (0) 2023.01.04
코크버섯  (0) 2023.01.04
뿔버섯  (0) 2023.01.04
주황버섯  (0) 2023.01.04