浙大远程《大数据库应用程序设计》离线作业.docx

上传人:b****0 文档编号:17716063 上传时间:2023-08-03 格式:DOCX 页数:32 大小:2.04MB
下载 相关 举报
浙大远程《大数据库应用程序设计》离线作业.docx_第1页
第1页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第2页
第2页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第3页
第3页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第4页
第4页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第5页
第5页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第6页
第6页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第7页
第7页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第8页
第8页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第9页
第9页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第10页
第10页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第11页
第11页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第12页
第12页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第13页
第13页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第14页
第14页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第15页
第15页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第16页
第16页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第17页
第17页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第18页
第18页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第19页
第19页 / 共32页
浙大远程《大数据库应用程序设计》离线作业.docx_第20页
第20页 / 共32页
亲,该文档总共32页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

浙大远程《大数据库应用程序设计》离线作业.docx

《浙大远程《大数据库应用程序设计》离线作业.docx》由会员分享,可在线阅读,更多相关《浙大远程《大数据库应用程序设计》离线作业.docx(32页珍藏版)》请在冰点文库上搜索。

浙大远程《大数据库应用程序设计》离线作业.docx

浙大远程《大数据库应用程序设计》离线作业

浙江大学远程教育学院

《数据库应用程序设计》课程作业

姓名:

学号:

年级:

学习中心:

—————————————————————————————

作业

第一章

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下列实数中哪些是合法的,哪些是不合法的?

不合法的请说明理由。

(A)0.25E+02(B).25+2(C)25E+2

(D)34.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表达式是下列哪个?

(A)Sin30(B)Sin(30)(C)SIN(30。

)(D)Sin(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

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > IT计算机 > 电脑基础知识

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2