版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
浙江大學(xué)遠(yuǎn)程教育學(xué)院
《數(shù)據(jù)庫應(yīng)用程序設(shè)計》課程作業(yè)
姓名:學(xué)號:
年級:學(xué)習(xí)中心:
作業(yè)
第一章
1.5如何保存Delphi的項目?嘗試自己動手創(chuàng)建一個項目,并保存。
答:執(zhí)行Fi1e|SaveAll菜單命令或單擊工具欄中的SaveAll按鈕便可保存,在
保存時可以對工程文獻(xiàn)和單元文獻(xiàn)進(jìn)行改名,但后綴名不能改。保存文獻(xiàn)之后,單擊工具中的
Run按鈕或按F9鍵,系統(tǒng)將開始編譯、連接、運營該工程。
一Projecting2017/5/2919:05CFG文件1KB
,Projectlxiof-五而TiiSI-7還
,Prqjectlxipr2017/5/2919:05DelphiProject1KB
CProjectl.res2017/5/2919:04RESFile1KB
?一test.dfm2017/5/2919^4DelphiForm1KB
乖testpas2017/5/2919:04DelphiSourceRie1KB
1.7嘗試設(shè)計如圖1—10所示的窗體。(圖見教材P15頁圖1-10)
圖1一10
>關(guān)閉”二機
您確實要:■:::
■■?
?關(guān)機r重啟「注銷
您確實要
G耒機「更后「注銷
確定|取消|
第二章
2.8設(shè)計如圖2—5所示的界面。單擊“按鈕1〃或“按鈕2〃時在標(biāo)簽上顯示用戶所執(zhí)行的操作。
單擊"啟動/停用按鈕"可控制"按鈕1〃和"按鈕2〃是否可用,單擊“退出系統(tǒng)”按鈕時,結(jié)束程
序的運營.
2.9設(shè)計如圖2—6所示的界面。當(dāng)單擊按鈕時,可控制文本框中字體的顏色。
圖2—5。圖2—6
按鈕豈按鈕2|
您點擊了按鈕1
開啟,倬用按鈕
退出接招
implementation
{$R*.dfm}
procedureTForml.btnlClick(Sender:TObject);
begin
forml.showLabe1.Caption’您點擊了按鈕1';
end;
procedureTForml.btn2Click(Sender:TObject);
begin
forml.showLabe1.Caption:='您點擊了按鈕2';
end;
procedureTForml.exitBtnC1ick(Sender:TObject);
begin
form1.Close;end;
procedurcTForml.ct1BtnC1ick(Sender:TObject):
begin
1fct1Status=0then
begin
form1.btnl.Enab1ed:=false;
forml.btn2.Enabled:=fa1se;
ctlStatus:=1;
end
else
begin
forml.btnl.Enabled:=true;
form1.btn2.Enabled:=true;
ctlStatus:=0;
end;
end;
2.9:
請在文本框中輸入文字;
|請注意衣顏色的變化
空色他綠色(G)|黃色(B)]
Jf叁小組二時節(jié)懊用頭冽
請在文本框中輸入文字:
|請注意我顏唾的變化
|{紅色(R)|綠色(G)|一色(B)|
請在文本框中輸入文字:
I請注定我套包的變化
,—?????????一????????-、
紅色(R)綠色(GM黃色(B)
請在文本框中輸入文字:
I請注意我飄色的變化
紅色(R)綠色(G)黃色(B)
unittest;
interface
uses
Windows,Messages,SysUtilszVariants,Classes,Graphics,Contro1
s,Forms,
Dialogs,StdCtrls;
type
TForml=class(TForm)
Labell:TLabel;
Edit1:TEdit;
btnRed:TBu11on;
btnGreen:TButton;
btnBlue:TButton;
procedurebtnRedC1ick(Sender:TObject);
procedurebtnGreenCIick(Sender:T0bject);
procedurebtnBlueClick(Sender:T0bject);
private
{Privatedeciarations}
public
{Publicdeclarations}
end;
var
Form1:TForm1;
imp1ementation
{$R*.dfm}
procedureTForml.btnRedClick(Sender:TObject);
begin
form1.Editl.Font.Color:=c1red;
end;
procedureTForml.btnGreenC1ick(Sender:TObject);
begin
forml.Editl.Font.Co1or:=clgreen;
end;
procedureTForml.btnBlueC1ick(Sender:TObject):
begin
forml.Editl.Font.Color:=clblue;
end:
end.
第三章
3.8下列實數(shù)中哪些是合法的,哪些是不合法的?不合法的請說明理由。
(AJ0.25E+02(B).25+2(C)25E+2
(D)34.5。(E).123o(F)-3E-4
(A)合法,即為25
(B)不合法,小數(shù)點前必須有數(shù)字,如表達(dá)為0.25+2
(C)合法,即為2500
(D)合法,即為34.5
(E)不合法,同(2)
(F)合法,即為-0.0003
3.12數(shù)學(xué)式子sin30。寫成De1phi表達(dá)式是下列哪個?
(A)Sin30(B)Sin(30)(C)SlN(30。)“D)Sin(30*Pi/180)
D,需要把角度轉(zhuǎn)化為弧度
第四章
4.7運用3個數(shù)字編輯框分別輸入小時、分、秒,換算共有多少秒,然后使用標(biāo)簽輸出。
*眇數(shù)計菖器??4mL溫■]
時|@~百分[0~引秒[6~三
總共為0秒
步秒數(shù)計IMS.nl.^±!=LflUB
時[T^分「三秒f5-
總共為3963秒
unittest;
interface
uses
Windows,Messages,SysUtils,Variants,C1asses,Graphics,Centrols,For
ms,
Dialogs,StdCtr1s,Spin;
type
TForml=class(TForm)
SpinEdit1:TSpinEdit;
Labell:TLabe1;
Labe12:TLabel;
SpinEdit2:TSpinEdit;
Label3:TLabel;
SpinEdit3:TSpinEdit;
Labe14:TLabe1;
procedureSpinEditlChange(Sender:TObject);
procedureSpinEdit2Change(Sender:TObject);
procedureSpinEdit3Change(Sender:TObject);
private
{Privatedeciarations)
procedureCalcu1ateTimeToSencond(timeKind:String;time:integer);
Public
{Publicdec1arations}
end;
var
Forml:TForml;
hour:Integer=0;
minute:integer=0;
second:integer=0;
tot:integer=0;
implementation
{$R*.dfm}
procedureTForml.CalculateTimeToSencond(timeKind:String:time:integer);
begin
iftimeKind="hh'then
hour:—time
elseiftimeKind='mi'then
minute:=time
elseiftimeKind='ss'then
second:=time;
tot:=hour*60*60+minute*60+second;
forml.Label4.Caption:=,總共為'+IntToStr秒;
end;
procedureTForm1.SpinEditIChange(Sender:TObject);
begin
Forml.Calcu1ateTime?oSencond('hh,,StrToInt(Form1.SpinEdit1.Text));
end;
procedureTForml.SpinEdit2Change(Sender:TObject);
begin
Form1.CalculateTimeToSencond('mi',StrToInt(Forml.SpinEdit2,Text));
end;
procedureTForml.SpinEdit3Change(Sender:TObject);
begin
Forml.CalculateTimeToSencond('ss',StrToInt(Forml.SpinEdit3.Text));
end;
end.
4.8在編輯框中輸入?個實數(shù),運用備注框輸出該實數(shù)及其平方和平方根。
請輸入一個實數(shù)
輸出結(jié)果
》實效計算
清輸入一個實效碉
輸出結(jié)果05
手歌£^707106781186548
實款計宜
清輸入一個實孰|025E*2
輸出結(jié)果
unitUnitl;
interface
uses
Windows*Mcssages,Sysllti1s,Variants,Classes?Graphies>Controls,Forms,
Dialogs,StdCtrls;
type
TForml=c1ass(TForm)
Edit1:TEdit:
Labell:TLabe1;
Memo1:TMemo;
Label2:TLabe1;
procedureEditlChange(Sender:TObject);
private
{Privatedeclarations}
public
{Publicdeclarations}
end;
var
Forml:TForm1;
numi:Real;〃原實數(shù)num2:Real;〃實數(shù)平方
num3:Rea1;〃實數(shù)平方根
implementation
{$R*.dfm}
procedureTForml.EditlChange(Sender:TObject);
begin
ifforml.Editl.Text<>"then
begin
numl:=StrToF1oat(forml.Edit1,Text);
num2:=Sqr(num1);
num3:=Sqrt(numl);
forml.Memo1.Lines.CIear;
forml.Memo1.Lines.Add(,實數(shù)為+FloatToStr(num1));
form1.Memol.Lines.Add('平方為:'+FloatToStr(num2));
form1.Memol.Lines.Add('平方根為:'+FloatToStr(num3)):
end:
end;
end.
第五章
5.11任意給定3個實數(shù),按照從大到小的順序依次輸出這3個數(shù)。
,比8次小
::清壞人三個效
二:輸出結(jié)果
方比較大小[o?回
清膈入三個部
籟出結(jié)果8.4.1
unitUnitl;
interface
US
Windows,Messages,SyslltiIs,Variants,Classes,Graphics,Controls,Form
s,
Dia1ogs,StdCtrls;
type
TForml=c1ass(TForm)
numlEdit:TEdit;
Labell:TLabel;
Label2:TLabeI;
resuItLabeI:TLabel;
num2Edit:TEdit;
num3Edit:TEdit;
procedurenumlEditChange(Sender:TObject);
procedurenum2EditChange(Sender:T0bject);
procedurenum3EditChange(Sender:TObject);
private
{Privatedec1arations}
procedureCompareNumoerO;
public
{Publicdeclarations}
end;
var
Forml:TForml;
numl:Real;〃數(shù)字1
num2:Real;〃數(shù)字2
num3:ReaI;〃數(shù)字3
compnum:Real;〃比較時轉(zhuǎn)換2數(shù)
outStr:String;〃輸出結(jié)果;
imp1ementation
{$R*.dfm)
procedureTForm1.CompareNumber();
begin
if(trim(form1.numlEdit.Text)<>")And(trim(forml.num2Edit.Tex
>")And(trim(forml.num3Edit.Text)<>")then
begin
num1:=StrToF1oatfform1.numlEdit.Text);
num2:=StrToFIoatlforml.num2Edit.Text);
num3:=StrToFloat(forml.num3Edit.Text);
ifnum2>numl
then
begin
compnum:=num1:
num1:=num2;
num2:=compnum;
end;
ifnum3>num1then
begin
compnum:=numl;
numl:=num3;
num3:=compnum;
end;
ifnum3>num2then
begin
compnum:=num2;
num2:=num3;
num3:=compnum;
end;
outStr:=FloatToStr(numl)+'J+FloatToStr(rum2)+','+FloatToStr(n
um3);
forml.resultLabe1.Caption:=outStr;
end;
end;
procedureTForml.nJm1EditChange(Sender:TObject):
begin
form1.CompareNumber;end;procedureTForml.num2EditChange(Sender:TObj
ect);
begin
forml.CompareNumber;end;procedureTForml.num3EditChange(Sende
r:TObject);
begin
form1.CompareNumber;end;
end.
5.13假設(shè)工費的增幅標(biāo)準(zhǔn)為:若基本工資大于等于1000元,增長工資20%;若小于1000
元大于等于800元,則增長工資15%:若小于800元,則增長工資10%。請根據(jù)用戶在文本
框中輸入的基本工資,計算出增長后的工資。
基本工夷°
增加后的工資
基本工奧網(wǎng)
增加后的工資1J35
,辿t算
基本工奧[TOO
增加后的工實770
unitUnit1;
interfaceuses
Windows,Messages,SysUti1s,Variants,Classes,Graphics,ControlszFo
rms,
DiaIogs,StdCtrIs:type
TForml=class(TForm)
Labe11:TLabel;
Editl:TEdit;
Labe12:TLabel;
resultLabe1:TLabeI;
procedureEditlChange(Sender:TObject):
private
{Privatedeclarations}
public
{Pub1icdeelarations}
end;
Forml:TForml;
salary:ReaI;
outSalary:Real;
impIementation
{$R*.dfm}
procedureTForml.Edit1Change(Sender:TObject);
begin
salary:=StrToFloat(forml.Editl.Text);
if(salary>=1000)then
outSa1ary:=salary*(1+0.2)
elseif(salary<1000)And(salary>=800)then
outSalary:=salary*(1+0.15)
elseif(salary<800)then
outSa1ary:=salary*(1+0.1);
forml.resu1tLabel.Caption:=FloatToStr(outSa1ary);
end;
end.
第六章
6.5設(shè)s=lX2X3X???Xn,求s不大于20230時最大的n。
最大n
歲計算最大n1=1回waa-
總數(shù)i?
最大n7
unitUnitl;
interface
uses
Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,
Dialogs,StdCtrls;
type
TForml=class(TForm)
Labell:TLabel;
Edit1:TEdit;
Labe12:TLabel;
resultLabeI:TLabel;
procedureFormCreate(Sender:TObject);
private
{Privatedeclarations}
public
{Pub1icdeclarations}
end;
var
Forml:TForml;
number,n,tot:Integer;
imp1ementation
{$R*.dfm}
procedureTForm1,FormCreate(Sender:TObject);
begin
tot:=1;n:=0;
number:=StrToInt(form1.Edit1.Text);
Whiletot<=numberdo
begin
n:=n+1;
tot:=tot*n;
end;
forml.resultLabeLCaption:=IntToStr(n-1);
end;
end.
6.10在標(biāo)簽上輸出100~200之間的所有的奇數(shù),其33的倍數(shù)除外。
_______*______________________________________________________________
10110310710911311511912112512M31133137139143145149151155157161163167169173175179181105187191193197199
unitUnitl;
interface
uses
WindowszMessageszSysUti1s,Variants,Classes,Graphics,Contro1s,Form
Dia1ogs*StdCtrls;
type
TForml=class(TForm)
resu1tLabel:TLabe1;
procedureFormCreate(Sender:TObject);
private
{Privatedec1arations}
public
{Publicdec1arations}
end;
var
Forml:TForm1;
number,i:Integer;
outStr:String;imp1ementation
{$R*.dfm}
procedureTForm1.FormCreate(Sender:TObject);
begin
fori:=100to200do
begin
ifimod2<>0then
ifimod3cothen
outStr:=outStr+''+IntToStr(i):
form1.resu1tLabeI.Caption:=outStr;
end;
end;
end.
第七章
7.4求1?200這200個數(shù)的和,當(dāng)和大于10000時結(jié)束計算。(規(guī)定使用轉(zhuǎn)向語句)
步計真1?200的KJ回Aa-
總和為10011
unitUnitl;
interface
uses
Windows,Messages,SysUtils,Variants,Classes,Graphics,tro1s,Forms,
Dialogs,StdCtrls;
type
TForml=class(TForm)
Labell:TLabel;
procedureFormCreate(Sender:TObject):
private
{Privatedeclarations)
public
{Publicdeclarations}
end;
var
Forml:TForml;
sum,n:integer;
impIementation
{$R*.dfm}
procedureTForml.FormCreate(Sender:TObject);
begin
sum:=0;
n:=0;
repeat
n:=n4-1;
sum:=sum+n;
if(sum>10000)thenbreak;
untiln>=200;
forml.Label1.Caption:='總和為'+IntToStr(sum);
end;
end.
第八章
8.8編寫函數(shù),輸出100~500之間所有能同時被3和13整除的數(shù)。
?愛出披3和13整除的數(shù)IoI回一.:,
方城出被3413整除的數(shù)|回X
117156195234273312351390429468
unitUnitl;
interface
uses
Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,
Dialogs,StdCtr1s;
type
TForml=class(TForm)
Labe11:TLabel;
ProcedureFormCreate(Sender:TObject);
private
{Privatedeciarations}
FunctioncheckNum(num:integer):boolean;
pub1ic
{Pub1icdeclarations}
end;
var
Forml:TForml;
implementation
{$R*.dfm}
FunctionTForml.checkNum(num:integer):boolean;
varn:boolean;
begin
if(nummod3=0)And(nummod13=0)then
n:=true
e1se
n:=false;
resuit:=n;end;procedureTForm1.FormCreate(Sender:TObject);
vari:integer;
varout:string;begin
fori:=100to500do
begin
ifcheckNum⑴then
out:=out+''+IntToStr(i);
end;
forml.Label1.Caption:=out;
end;
end.
第九章
9.2打開對話框組件和打開圖片對話框組件有什么異同點?
答:兩者都會打開一個對話框用于選擇電腦本地上的文獻(xiàn)不同的是前者可以選擇所有類型的
文獻(xiàn),而后者只可以選擇圖片類型的文獻(xiàn),并且可以預(yù)覽圖片
第十章
10.7菜單命令項與工具欄按鈕的單擊事件中的代碼是否可以關(guān)聯(lián)?如何關(guān)聯(lián)?
答:將工具欄按鈕Too1Button的Sty1e屬性設(shè)立為tbsDropDown,然后在Me
nultem屬性中選擇相應(yīng)的菜單項即可
第十一章
11.4調(diào)用子窗體的dose方法時是否可關(guān)閉該子窗體?若不能,需要怎么做?
答:調(diào)用close方法只能最小化窗口,假如要真正關(guān)閉,需要調(diào)用free方法
第十二章
12.3使用紅色的畫筆在窗體中繪制一個半徑為5的圓,并且用黃色來填充圓的內(nèi)部。
unitUnitl;
interface
uses
Windews,Messagas,SysUtils.Variants.Classes,Graphics,Controls,Fo
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 公共交通應(yīng)急預(yù)案管理制度
- 2026年法學(xué)專業(yè)知識進(jìn)階考試題目及答案
- 2026年財務(wù)會計專業(yè)知識模擬考試試題
- 2026年汽車制造質(zhì)量監(jiān)督執(zhí)紀(jì)模擬測試題
- 2026年圍棋培訓(xùn)協(xié)議
- 母嬰護理質(zhì)量控制與安全管理
- 化驗樓抗爆安全改造項目環(huán)境影響報告表
- 河南省許昌市襄城縣玉成學(xué)校2025-2026學(xué)年第一學(xué)期期末教學(xué)質(zhì)量檢測七年級生物(含答案)
- 北京市昌平區(qū)2025-2026學(xué)年高二上學(xué)期1月期末考試政治試題(含答案)
- 2025年重慶醫(yī)藥高等專科學(xué)校單招職業(yè)傾向性考試題庫附答案解析
- 新高考語文專題訓(xùn)練之模擬題分類匯編文言文閱讀1(原卷版+解析)
- DL∕T 5545-2018 火力發(fā)電廠間接空冷系統(tǒng)設(shè)計規(guī)范
- DZ∕T 0130-2006 地質(zhì)礦產(chǎn)實驗室測試質(zhì)量管理規(guī)范(正式版)
- 《研學(xué)旅行課程設(shè)計》課件-研學(xué)課程設(shè)計原則
- JJG 693-2011可燃?xì)怏w檢測報警器
- (本科)大學(xué)生勞動教育理論與實踐教程全書電子教案完整版
- 黑龍江省中藥飲片炮制規(guī)范及標(biāo)準(zhǔn)
- 盤口暗語及盤口數(shù)字語言
- QC-提高衛(wèi)生間防水一次驗收合格率
- 彈藥庫防火防爆消防演示
- 大地測量控制點坐標(biāo)轉(zhuǎn)換技術(shù)規(guī)程
評論
0/150
提交評論