Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Записка к КП.doc
Скачиваний:
2
Добавлен:
22.09.2019
Размер:
571.39 Кб
Скачать

Заключение

Программный модуль «Калькулятор простых дробей» был разработан в качестве курсового проекта.

При реализации поставленной задачи были пройдены следующие этапы:

  1. изучение предложенной задачи;

  2. реализация задачи в программной среде Delphi;

  3. проведение различных тестов над готовой программой для доказательства ее корректной работы.

В результате работы над курсовым проектом была проведена самостоятельная исследовательская работа, а также систематизированы, закреплены и углублены теоритические и практические знания, отработаны практические навыки, сформированные на протяжении учебы по специальности, которые были применены для решения конкретной задачи.

Кроме этого были расширены некоторые знания из данной предметной области и укреплены знания объектно-ориентированного языка программирования Delphi 7. При реализации проекта были пройдены этапы описания и постановки задачи, кодирования программы на алгоритмический язык и тестирования полученного приложения.

Список использованных источников

1. Культин Н.Б. Основы программирования в Delphi 7, 2-е издание - М.: БХВ-Петербург, 2008. – 630 с.

2. А.И.Павловский, А.Е. Пупцев, П.Л. Гращенко Информатика 10 класса - М.: Народная асвета, 2000. – 222 с.

3.ГОСТ 19.701-90 ЕСПД СХЕМЫ АЛГОРИТМОВ, ПРОГРАММ, ДАННЫХ И СИСТЕМ.

4.ГОСТ 2.105-95 Единая система конструкторской документации ОБЩИЕ ТРЕБОВАНИЯ К ТЕКСТОВЫМ ДОКУМЕНТАМ.

ПРИЛОЖЕНИЯ

Приложение а Руководство программиста

Программный модуль предназначен для проведения теста по языку программирования «Калькулятор простых дробей».

Для нормальной работы программы требуются следующие системные требования: CPU – Intel Pentium 1 ГHz или выше, Операционная система – Microsoft XP ; RAM – 512 Mb; Объём свободной памяти – 55 Mb; VGA или более высокая разрешающая способность монитора. Навигация в программе осуществляется указательным устройством (мышкой) и клавиатурой.

Программный продукт не требует специальной инсталляции. Для работы с программой достаточно папку с программой скопировать на жесткий диск или на другой носитель.

Для начала работы с программой нужно запустить Kalk.exe. После чего появится окно для работы в программе.

Приложение б Код программы

unit Unit1;

interface

uses

Windows, Messages, SysUtils,xpman, Variants, Classes, Graphics,

Controls, Forms, Dialogs, StdCtrls, Menus, CheckLst, jpeg, ExtCtrls;

type

TForm1 = class(TForm)

Edit1: TEdit;

Edit2: TEdit;

Edit3: TEdit;

Edit4: TEdit;

Button1: TButton;

MainMenu1: TMainMenu;

ComboBox1: TComboBox;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Label8: TLabel;

Label9: TLabel;

Button2: TButton;

Button3: TButton;

Button4: TButton;

Image1: TImage;

Image2: TImage;

Button5: TButton;

Button6: TButton;

Button7: TButton;

Button8: TButton;

Button9: TButton;

Button10: TButton;

Button11: TButton;

Button12: TButton;

Button13: TButton;

Button14: TButton;

Button15: TButton;

Button16: TButton;

Button17: TButton;

N6: TMenuItem;

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Edit1KeyPress(Sender: TObject; var Key: Char);

procedure Edit2KeyPress(Sender: TObject; var Key: Char);

procedure Edit3KeyPress(Sender: TObject; var Key: Char);

procedure Edit4KeyPress(Sender: TObject; var Key: Char);

procedure N2Click(Sender: TObject);

procedure N5Click(Sender: TObject);

procedure Image1Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure Edit1Click(Sender: TObject);

procedure Edit2Click(Sender: TObject);

procedure Edit3Click(Sender: TObject);

procedure Edit4Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

procedure Button7Click(Sender: TObject);

procedure Button8Click(Sender: TObject);

procedure Button9Click(Sender: TObject);

procedure Button10Click(Sender: TObject);

procedure Button11Click(Sender: TObject);

procedure Button12Click(Sender: TObject);

procedure Button13Click(Sender: TObject);

procedure Button14Click(Sender: TObject);

procedure Button16Click(Sender: TObject);

procedure Button15Click(Sender: TObject);

procedure Button17Click(Sender: TObject);

procedure N6Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

a,b,c,d,noz,m1,m2,s,r,i,k,v:integer;

Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);

begin

ComboBox1.Items.Add('+');

ComboBox1.Items.Add('-');

ComboBox1.Items.Add('*');

ComboBox1.Items.Add('/');

Edit1.MaxLength:=5;

Edit2.MaxLength:=5;

Edit3.MaxLength:=5;

Edit4.MaxLength:=5;

Image1.Visible:=false;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

if (Edit1.Text <> '') and (Edit2.Text <> '') and (Edit3.Text <> '') and (Edit4.Text <> '') then

begin

Label1.Caption:='';

Label2.Caption:='';

Label3.Caption:='';

Label5.Caption:='';

Label6.Caption:='';

Label7.Caption:='';

Label8.Caption:='';

a:=strtoint(Edit1.Text);

b:=strtoint(Edit2.Text);

c:=strtoint(Edit3.Text);

d:=strtoint(Edit4.Text);

if ComboBox1.ItemIndex = 0 then

begin

if b>d then

begin

noz:=b;

end

else

noz:=d;

if not((noz mod b = 0) and (noz mod d = 0)) then

begin

repeat

noz:=noz+1;

until (noz mod b = 0) and (noz mod d = 0);

end;

Label5.Caption:='НОЗ= '+inttostr(noz);

m1:=noz div b;

m2:=noz div d;

s:=(a*m1)+(c*m2);

Label6.Caption:='Числитель= '+inttostr(s);

Label7.Caption:='Знаменатель= '+inttostr(noz);

Label2.Caption:=inttostr(s);

Label3.Caption:=inttostr(noz);

end;

if ComboBox1.ItemIndex = 1 then

begin

if b>d then

noz:=b

else

noz:=d;

if not((noz mod b = 0) and (noz mod d = 0)) then

begin

repeat

noz:=noz+1;

until (noz mod b = 0) and (noz mod d = 0);

end;

Label5.Caption:='НОЗ= '+inttostr(noz);

m1:=noz div b;

m2:=noz div d;

s:=(a*m1)-(c*m2);

Label6.Caption:='Числитель= '+inttostr(s);

Label7.Caption:='Знаменатель= '+inttostr(noz);

Label2.Caption:=inttostr(s);

Label3.Caption:=inttostr(noz);

end;

if ComboBox1.ItemIndex = 2 then

begin

s:=a*c;

noz:=b*d;

Label2.Caption:=inttostr(s);

Label3.Caption:=inttostr(noz);

Label6.Caption:='Числитель= '+inttostr(s);

Label7.Caption:='Знаменатель= '+inttostr(noz);

end;

if ComboBox1.ItemIndex = 3 then

begin

s:=a*d;

noz:=b*c;

Label2.Caption:=inttostr(s);

Label3.Caption:=inttostr(noz);

Label6.Caption:='Числитель= '+inttostr(s);

Label7.Caption:='Знаменатель= '+inttostr(noz);

end;

end;

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

if (Label1.Caption = '') and (Label2.Caption <> '') then

begin

s:= StrToInt(Label2.Caption);

noz:= StrToInt(Label3.Caption);

r:=0;

if s div noz <> 0 then

begin

r:=s div noz;

s:=s-(r*noz);

end;

Label1.Caption:=inttostr(r);

Label8.Caption:='Целая часть= '+inttostr(r);

Label2.Caption:=inttostr(s);

end

end;

procedure TForm1.Button3Click(Sender: TObject);

begin

if Label2.Caption <> '' then

begin

k:=1;

s:= StrToInt(Label2.Caption);

noz:= StrToInt(Label3.Caption);

For i:=999 downto 2 do

begin

if (s mod i = 0) and (noz mod i = 0) then

begin

s:=s div i;

noz:=noz div i;

k:=k*i;

end;

end;

Label2.Caption:=inttostr(s);

Label3.Caption:=inttostr(noz);

Label9.Caption:='НОК= '+ (inttostr(k));

end;

end;

procedure TForm1.Button4Click(Sender: TObject);

begin

if (Label1.Caption <>'') then

begin

s:= StrToInt(Label2.Caption);

noz:= StrToInt(Label3.Caption);

r:= StrToInt(Label1.Caption);

s:=s+(r*noz);

Label1.Caption:='';

Label2.Caption:=inttostr(s);

Label3.Caption:=inttostr(noz);

Label8.Caption:='';

end;

end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);

begin

if not (Key in ['0'..'9',DecimalSeparator, #8,'-']) then Key := #0;

end;

procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);

begin

if not (Key in ['0'..'9',DecimalSeparator, #8,'-']) then Key := #0;

end;

procedure TForm1.Edit3KeyPress(Sender: TObject; var Key: Char);

begin

if not (Key in ['0'..'9',DecimalSeparator, #8,'-']) then Key := #0;

end;

procedure TForm1.Edit4KeyPress(Sender: TObject; var Key: Char);

begin

if not (Key in ['0'..'9',DecimalSeparator, #8,'-']) then Key := #0;

end;

procedure TForm1.N2Click(Sender: TObject);

begin

Form1.Close;

end;

procedure TForm1.N5Click(Sender: TObject);

begin

Image1.Visible:=true;

Edit1.Visible:=False;

Edit2.Visible:=False;

Edit3.Visible:=False;

Edit4.Visible:=False;

Button1.Visible:=False;

ComboBox1.Visible:=False;

Label1.Visible:=False;

Label2.Visible:=False;

Label3.Visible:=False;

Label4.Visible:=False;

Label5.Visible:=False;

Label6.Visible:=False;

Label7.Visible:=False;

Label8.Visible:=False;

Label9.Visible:=False;

Button2.Visible:=False;

Button3.Visible:=False;

Button4.Visible:=False;

Button5.Visible:=False;

Button6.Visible:=False;

Button7.Visible:=False;

Button8.Visible:=False;

Button9.Visible:=False;

Button10.Visible:=False;

Button11.Visible:=False;

Button12.Visible:=False;

Button13.Visible:=False;

Button14.Visible:=False;

Button15.Visible:=False;

Button16.Visible:=False;

Button17.Visible:=False;

end;

end;

procedure TForm1.Button5Click(Sender: TObject);

begin

if v = 1 then

edit1.Text:=Edit1.Text + '1';

if v = 2 then

edit2.Text:=Edit2.Text + '1';

if v = 3 then

edit3.Text:=Edit3.Text + '1';

if v = 4 then

edit4.Text:=Edit4.Text + '1';

end;

procedure TForm1.Edit1Click(Sender: TObject);

begin

v:=1;

end;

procedure TForm1.Edit2Click(Sender: TObject);

begin

v:=2;

end;

procedure TForm1.Edit3Click(Sender: TObject);

begin

v:=3;

end;

procedure TForm1.Edit4Click(Sender: TObject);

begin

v:=4;

end;

procedure TForm1.Button6Click(Sender: TObject);

begin

if v = 1 then

edit1.Text:=Edit1.Text + '2';

if v = 2 then

edit2.Text:=Edit2.Text + '2';

if v = 3 then

edit3.Text:=Edit3.Text + '2';

if v = 4 then

edit4.Text:=Edit4.Text + '2';

end;

procedure TForm1.Button7Click(Sender: TObject);

begin

if v = 1 then

edit1.Text:=Edit1.Text + '3';

if v = 2 then

edit2.Text:=Edit2.Text + '3';

if v = 3 then

edit3.Text:=Edit3.Text + '3';

if v = 4 then

edit4.Text:=Edit4.Text + '3';

end;

procedure TForm1.Button11Click(Sender: TObject);

begin

if v = 1 then

edit1.Text:=Edit1.Text + '7';

if v = 2 then

edit2.Text:=Edit2.Text + '7';

if v = 3 then

edit3.Text:=Edit3.Text + '7';

if v = 4 then

edit4.Text:=Edit4.Text + '7';

end;

procedure TForm1.Button12Click(Sender: TObject);

begin

if v = 1 then

edit1.Text:=Edit1.Text + '8';

if v = 2 then

edit2.Text:=Edit2.Text + '8';

if v = 3 then

edit3.Text:=Edit3.Text + '8';

if v = 4 then

edit4.Text:=Edit4.Text + '8';

end;

procedure TForm1.Button13Click(Sender: TObject);

begin

if v = 1 then

edit1.Text:=Edit1.Text + '9';

if v = 2 then

edit2.Text:=Edit2.Text + '9';

if v = 3 then

edit3.Text:=Edit3.Text + '9';

if v = 4 then

edit4.Text:=Edit4.Text + '9';

end;