Created
January 8, 2020 16:49
-
-
Save leequixxx/62d63e84e52c4e41ff3d8a378f1dcc84 to your computer and use it in GitHub Desktop.
Lab 14 (Variant 3)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program task14; | |
{$IFDEF FPC} | |
{$MODE DELPHI} | |
{$ENDIF} | |
type TSex = (male, female); | |
type TMan = class(TObject) | |
private | |
FName: String; | |
FAge: Integer; | |
FSex: TSex; | |
FWeight: Double; | |
private | |
procedure SetName(Value: String); | |
procedure SetAge(Value: Integer); | |
procedure SetSex(Value: TSex); | |
procedure SetWeight(Value: Double); | |
function GetName: String; | |
function GetAge: Integer; | |
function GetSex: TSex; | |
function GetWeight: Double; | |
public | |
property Name: String read GetName write SetName; | |
property Age: Integer read GetAge write SetAge; | |
property Sex: TSex read GetSex write SetSex; | |
property Weight: Double read GetWeight write SetWeight; | |
public | |
constructor Create(Name: String; Age: Integer; Sex: TSex; Weight: Double); | |
public | |
class function Input: TMan; static; | |
class function GetSubjectName: String; static; | |
end; | |
procedure TMan.SetName(Value: String); | |
begin | |
Name := Value; | |
end; | |
procedure TMan.SetAge(Value: Integer); | |
begin | |
Age := Value; | |
end; | |
procedure TMan.SetSex(Value: TSex); | |
begin | |
Sex := Value; | |
end; | |
procedure TMan.SetWeight(Value: Double); | |
begin | |
Weight := Value; | |
end; | |
function TMan.GetName: String; | |
begin | |
GetName := FName; | |
end; | |
function TMan.GetAge: Integer; | |
begin | |
GetAge := FAge; | |
end; | |
function TMan.GetSex: TSex; | |
begin | |
GetSex := FSex; | |
end; | |
function TMan.GetWeight: Double; | |
begin | |
GetWeight := FWeight; | |
end; | |
constructor TMan.Create(Name: String; Age: Integer; Sex: TSex; Weight: Double); | |
begin | |
FName := Name; | |
FAge := Age; | |
FSex := Sex; | |
FWeight := Age; | |
end; | |
class function TMan.Input: TMan; | |
var Name: String; | |
var Age: Integer; | |
var Sex: TSex; | |
var Weight: Double; | |
begin | |
Write('Please, enter a name of ', GetSubjectName, ': '); | |
ReadLn(Name); | |
while True do | |
begin | |
try | |
except | |
end; | |
end; | |
end; | |
begin | |
WriteLn('Hello, world'); | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment