版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
/XX大学远程教育学院《数据库应用程序设计》课程作业姓名:学号:年级:学习中心:—————————————————————————————作业第一章1.5如何保存Delphi的项目?尝试自己动手创建一个项目,并保存。答:执行File|Save
All菜单命令或单击工具栏中的Save
All按钮便可保存,在保存时可以对工程文件和单元文件进行改名,但后缀名不能改。保存文件之后,单击工具中的Run按钮或按F9键,系统将开始编译、连接、运行该工程。1.7尝试设计如图1-10所示的窗体。〔图见教材P15页图1-10图1-10第二章2.8设计如图2-5所示的界面。单击"按钮1”或"按钮2”时在标签上显示用户所执行的操作。单击"开启/停用按钮"可控制"按钮1”和"按钮2”是否可用,单击"退出系统"按钮时,结束程序的运行。2.9设计如图2-6所示的界面。当单击按钮时,可控制文本框中字体的颜色。图2-5 图2-6
unit
test;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
showLabel:
TLabel;
btn1:
TButton;
//按钮1
btn2:
TButton;
//按钮2
ctlBtn:
TButton;
//开启停用按钮exitBtn:
TButton;
//退出按钮procedure
btn1Click<Sender:
TObject>;
procedure
btn2Click<Sender:
TObject>;
procedure
exitBtnClick<Sender:
TObject>;
procedure
ctlBtnClick<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
ctlStatus:integer
=
0;
//控制按钮1和2的开启和关闭,0表示当前为开启,1表示关闭implementation
{$R
*.dfm}
procedure
TForm1.btn1Click<Sender:
TObject>;begin
form1.showLabel.Caption
:=
'您点击了按钮1';
end;
procedure
TForm1.btn2Click<Sender:
TObject>;
begin
form1.showLabel.Caption
:=
'您点击了按钮2';
end;
procedure
TForm1.exitBtnClick<Sender:
TObject>;
begin
form1.Close;
end;
procedure
TForm1.ctlBtnClick<Sender:
TObject>;
begin
if
ctlStatus
=
0
then
begin
form1.btn1.Enabled
:=
false;
form1.btn2.Enabled
:=
false;
ctlStatus
:=
1;
end
else
begin
form1.btn1.Enabled
:=
true;
form1.btn2.Enabled
:=
true;
ctlStatus
:=
0;
end;
end;
end.
2.9:unit
test;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Label1:
TLabel;
Edit1:
TEdit;
btnRed:
TButton;
btnGreen:
TButton;
btnBlue:
TButton;
procedure
btnRedClick<Sender:
TObject>;
procedure
btnGreenClick<Sender:
TObject>;
procedure
btnBlueClick<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
implementation
{$R
*.dfm}
procedure
TForm1.btnRedClick<Sender:
TObject>;
begin
form1.Edit1.Font.Color
:=
clred;end;
procedure
TForm1.btnGreenClick<Sender:
TObject>;
begin
form1.Edit1.Font.Color
:=
clgreen;
end;
procedure
TForm1.btnBlueClick<Sender:
TObject>;
begin
form1.Edit1.Font.Color
:=
clblue;
end;
end.第三章3.8下列实数中哪些是合法的,哪些是不合法的?不合法的请说明理由。〔A0.25E+02 〔B.25+2 〔C25E+2〔D34.5 〔E.123 〔F-3E-4〔A合法,即为25
〔B不合法,小数点前必须有数字,如表示为0.25+2
〔C合法,即为2500
〔D合法,即为34.5
〔E不合法,同〔2
〔F合法,即为‐0.0003
3.12数学式子sin30。写成Delphi表达式是下列哪个?〔ASin30 〔BSin<30> 〔CSIN〔30。〔DSin<30*Pi/180>D,需要把角度转化为弧度第四章4.7利用3个数字编辑框分别输入小时、分、秒,换算共有多少秒,然后使用标签输出。unit
test;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls,
Spin;
type
TForm1
=
class<TForm>
SpinEdit1:
TSpinEdit;
Label1:
TLabel;
Label2:
TLabel;
SpinEdit2:
TSpinEdit;
Label3:
TLabel;
SpinEdit3:
TSpinEdit;
Label4:
TLabel;
procedure
SpinEdit1Change<Sender:
TObject>;
procedure
SpinEdit2Change<Sender:
TObject>;
procedure
SpinEdit3Change<Sender:
TObject>;
private
{
Private
declarations
}
procedure
CalculateTimeToSencond<timeKind:String;
time:integer>;
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
hour:
integer
=
0;
minute:
integer
=
0;
second:
integer
=
0;
tot:integer
=
0;
implementation
{$R
*.dfm}
procedure
TForm1.CalculateTimeToSencond<timeKind:String;
time:integer>;
begin
if
timeKind
=
'hh'
then
hour
:=
time
else
if
timeKind
=
'mi'
then
minute
:=
time
else
if
timeKind
=
'ss'
then
second
:=
time;
tot
:=
hour
*
60
*
60
+
minute
*
60
+
second;
form1.Label4.Caption
:=
'总共为'
+
IntToStr<tot>
+
'秒';
end;
procedure
TForm1.SpinEdit1Change<Sender:
TObject>;
begin
Form1.CalculateTimeToSencond<'hh',
StrToInt<Form1.SpinEdit1.Text>>;
end;
procedure
TForm1.SpinEdit2Change<Sender:
TObject>;
begin
Form1.CalculateTimeToSencond<'mi',
StrToInt<Form1.SpinEdit2.Text>>;
end;
procedure
TForm1.SpinEdit3Change<Sender:
TObject>;
begin
Form1.CalculateTimeToSencond<'ss',
StrToInt<Form1.SpinEdit3.Text>>;
end;
end.
4.8在编辑框中输入一个实数,利用备注框输出该实数及其平方和平方根。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Edit1:
TEdit;
Label1:
TLabel;
Memo1:
TMemo;
Label2:
TLabel;
procedure
Edit1Change<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
num1
:
Real;
//原实数
num2
:
Real;
//实数平方num3
:
Real;
//实数平方根
implementation
{$R
*.dfm}
procedure
TForm1.Edit1Change<Sender:
TObject>;
begin
if
form1.Edit1.Text
<>
''
then
begin
num1
:=
StrToFloat<form1.Edit1.Text>;
num2
:=
Sqr<num1>;
num3
:=
Sqrt<num1>;
form1.Memo1.Lines.Clear;
form1.Memo1.Lines.Add<'实数为
:
'
+
FloatToStr<num1>>;
form1.Memo1.Lines.Add<'平方为
:
'
+
FloatToStr<num2>>;
form1.Memo1.Lines.Add<'平方根为
:
'
+
FloatToStr<num3>>;
end;
end;
end.第五章5.11任意给定3个实数,按照从大到小的顺序依次输出这3个数。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
num1Edit:
TEdit;
Label1:
TLabel;
Label2:
TLabel;
resultLabel:
TLabel;
num2Edit:
TEdit;
num3Edit:
TEdit;
procedure
num1EditChange<Sender:
TObject>;
procedure
num2EditChange<Sender:
TObject>;
procedure
num3EditChange<Sender:
TObject>;
private
{
Private
declarations
}
procedure
CompareNumber<>;
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
num1
:
Real;
//数字1
num2
:
Real;
//数字2
num3
:
Real;
//数字3
compnum
:
Real;
//比较时转换2数outStr
:
String;
//输出结果;
implementation
{$R
*.dfm}
procedure
TForm1.CompareNumber<>;
begin
if
<trim<form1.num1Edit.Text>
<>
''>
And
<trim<form1.num2Edit.Text>
<>
''>
And
<trim<form1.num3Edit.Text>
<>
''>
then
begin
num1
:=
StrToFloat<form1.num1Edit.Text>;
num2
:=
StrToFloat<form1.num2Edit.Text>;
num3
:=
StrToFloat<form1.num3Edit.Text>;
if
num2
>
num1
then
begin
compnum
:=
num1;
num1
:=
num2;
num2
:=
compnum;
end;
if
num3
>
num1
then
begin
compnum
:=
num1;
num1
:=
num3;
num3
:=
compnum;
end;
if
num3
>
num2
then
begin
compnum
:=
num2;
num2
:=
num3;
num3
:=
compnum;
end;
outStr
:=
FloatToStr<num1>
+
','
+
FloatToStr<num2>
+
','
+
FloatToStr<num3>;
form1.resultLabel.Caption
:=
outStr;
end;
end;
procedure
TForm1.num1EditChange<Sender:
TObject>;
begin
form1.CompareNumber;
end;
procedure
TForm1.num2EditChange<Sender:
TObject>;
begin
form1.CompareNumber;
end;
procedure
TForm1.num3EditChange<Sender:
TObject>;
begin
form1.CompareNumber;
end;
end.
5.13假设工资的增幅标准为:若基本工资大于等于1000元,增加工资20%;若小于1000元大于等于800元,则增加工资15%;若小于800元,则增加工资10%。请根据用户在文本框中输入的基本工资,计算出增加后的工资。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Label1:
TLabel;
Edit1:
TEdit;
Label2:
TLabel;
resultLabel:
TLabel;
procedure
Edit1Change<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
salary:
Real;
outSalary:
Real;
implementation
{$R
*.dfm}
procedure
TForm1.Edit1Change<Sender:
TObject>;
begin
salary
:=
StrToFloat<form1.Edit1.Text>;
if
<salary
>=
1000>
then
outSalary
:=
salary
*
<1
+
0.2>
else
if
<salary
<
1000>
And
<salary
>=
800>
then
outSalary
:=
salary
*
<1
+
0.15>
else
if
<salary
<
800>
then
outSalary
:=
salary
*
<1
+
0.1>;
form1.resultLabel.Caption
:=
FloatToStr<outSalary>;
end;
end.
第六章6.5设s=1X2X3X…Xn,求s不大于20000时最大的n。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Label1:
TLabel;
Edit1:
TEdit;
Label2:
TLabel;
resultLabel:
TLabel;
procedure
FormCreate<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
number,
n,
tot:
Integer;
implementation
{$R
*.dfm}
procedure
TForm1.FormCreate<Sender:
TObject>;
begin
tot
:=
1;
n
:=
0;
number
:=
StrToInt<form1.Edit1.Text>;
While
tot
<=
number
do
begin
n
:=
n
+
1;
tot
:=
tot
*
n;
end;
form1.resultLabel.Caption
:=
IntToStr<n‐1>;
end;
end.
6.10在标签上输出100~200之间的所有的奇数,其中3的倍数除外。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
resultLabel:
TLabel;
procedure
FormCreate<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
number,
i:
Integer;
outStr:
String;
implementation
{$R
*.dfm}
procedure
TForm1.FormCreate<Sender:
TObject>;
begin
for
i:=
100
to
200
do
begin
if
i
mod
2
<>
0
then
if
i
mod
3
<>
0
then
outStr
:=
outStr
+
'
'
+
IntToStr<i>;
form1.resultLabel.Caption
:=
outStr;
end;
end;
end.第七章7.4求1~200这200个数的和,当和大于10000时结束计算。〔要求使用转向语句unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Label1:
TLabel;
procedure
FormCreate<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
sum,
n
:
integer;
implementation
{$R
*.dfm}
procedure
TForm1.FormCreate<Sender:
TObject>;
begin
sum
:=
0;
n
:=
0;
repeat
n
:=
n
+
1;
sum
:=
sum
+
n;
if
<sum
>
10000>
then
break;
until
n
>=
200;
form1.Label1.Caption
:=
'总和为'
+
IntToStr<sum>;end;
end.
第八章8.8编写函数,输出100~500之间所有能同时被3和13整除的数。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Label1:
TLabel;
procedure
FormCreate<Sender:
TObject>;
private
{
Private
declarations
}
Function
checkNum<num:integer>:boolean;
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
implementation
{$R
*.dfm}
Function
TForm1.checkNum<num:integer>:boolean;
var
n
:boolean;
begin
if
<num
mod
3
=
0>
And
<num
mod
13
=
0>
then
n
:=
true
else
n
:=
false;
result
:=
n;
end;
procedure
TForm1.FormCreate<Sender:
TObject>;
var
i
:
integer;
var
out
:
string;
begin
for
i
:=
100
to
500
do
begin
if
checkNum<i>
then
out
:=
out
+
'
'
+
IntToStr<i>;
end;
form1.Label1.Caption
:=
out;
end;
end.
第九章9.2打开对话框组件和打开图片对话
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 输煤系统综合治理方案
- 互联网产品经理招聘笔试题与参考答案(某大型央企)2025年
- 2024年度钢材供应与钢结构施工体化服务合同3篇
- 基于2024年度市场行情租房合同的租金支付方式2篇
- 2024年度文化传媒公司制作合同服务内容详细描述2篇
- 清扫垃圾合同协议书垃圾清理合同
- 2024版居间合同:工程设计款支付协议3篇
- 年度农产品质量检测服务合同2024
- 技术服务合同简易版
- 美甲店店铺转让合同模板
- 产品异常分析报告
- 中医各家学说-丹溪学派
- 金融学专业职业生涯规划书
- 安保人员岗位职责明确
- 孕产妇心理健康指导
- 遗传学5第四章连锁遗传和性连锁课件
- 学术综合英语(罗立胜)1-6单元课文翻译
- 新译林版五年级上册各单元教学反思(文本版本)(共5则)
- 适老化居家看护产品设计研究
- Cpk及Ppk计算电子表格模板
- 请结合当前中国面临的国际局势谈谈我国建立独立的、比较完整的工业体系和国民经济体系的重大意义参考答案
评论
0/150
提交评论