StartprogrammingusingObjectPascal:RestaurantProgram

From 흡혈양파의 번역工房
Jump to navigation Jump to search

음식점 프로그램

var
    Meal: Byte;
begin
    Writeln('Welcome to Pascal Restaurant. Please select your order');
    Writeln('1 - Chicken (10$)');
    Writeln('2 - Fish (7$)');
    Writeln('3 - Meat (8$)');
    Writeln('4 - Salad (2$)');
    Writeln('5 - Orange Juice (1$)');
    Writeln('6 - Milk (1$)');
    Writeln;
    Write('Please enter your selection: ');
    Readln(Meal);

    case Meal of
        1: Writeln('You have ordered Chicken,',
            ' this will take 15 minutes');
        2: Writeln('You have ordered Fish, this will take 12 minutes');
        3: Writeln('You have ordered meat, this will take 18 minutes');
        4: Writeln('You have ordered Salad, this will take 5 minutes');
        5: Writeln('You have ordered Orange juice,',
            ' this will take 2 minutes');
        6: Writeln('You have ordered Milk, this will take 1 minute');
    else
        Writeln('Wrong entry');
    end;

    Write('Press enter key to close');
    Readln;
end.


if 조건문을 사용하여 같은 프로그램을 작성한다면, 더 복잡하게 될 것이고, 코드가 중복 될 것입니다.