android开发计算器课程设计Word格式.docx
《android开发计算器课程设计Word格式.docx》由会员分享,可在线阅读,更多相关《android开发计算器课程设计Word格式.docx(24页珍藏版)》请在冰豆网上搜索。
1.1系统的可行性分析
可行性研究是为了弄清楚系统开发的项目是不是可以实现和值得进行研究的过程,实际上是一次大大简化系统分析和系统设计的过程,所以,进行可执行性的分析是非常必要的,也是很重要的,经过最初的设计目标和进行的实时调查得出以下四点的可行性分析:
(1)技术可行性:
Eclipse+AndroidADT的技术已经较为成熟,通过SUN公司(现被ORCEL公司收购)推出的跨平台、动态的JAVA语言进行开发。
(2)运行可行性:
该系统需要Android虚拟机环境,Eclipse中安装ADT,DDMS等GoogleAndroid相关插件。
其运行环境已经相当稳定,它功能丰富,包括了完备的Android程序的编码、调试、测试和发布功能,其中支持所有Android应用开发相关技术,包括SQLite,Skia,3D制作,AndroidXML,能够很好的发布Android的应用程序APK包。
(3)法律可行性:
因为是自主开发设计,所以不会构成侵权,在法律上是可行的。
通过以上的可行性分析,将采用Eclipse+AndroidADT+DDMS技术,运用JAVA语言进行系统的开发。
1.2系统的需求分析
根据分析需求,这个系统必须实现以下的功能:
(1)实现简单的数字计算功能。
作为计算器,其核心就是加减乘除。
(2)能够在手机里面以良好的界面。
第二章系统详细设计
2.1activity的详细设计
packagecom.example.counter;
importandroid.os.Bundle;
importandroid.app.Activity;
importandroid.view.Menu;
importandroid.view.View;
importandroid.view.View.OnClickListener;
importandroid.widget.Button;
importandroid.widget.TextView;
publicclassMainActivityextendsActivity{
privateTextViewtextView1=null;
privateButtonbuttonzone=null;
privateButtonbutton1=null;
privateButtonbutton2=null;
privateButtonbutton3=null;
privateButtonbutton4=null;
privateButtonbutton5=null;
privateButtonbutton6=null;
privateButtonbutton7=null;
privateButtonbutton8=null;
privateButtonbutton9=null;
privateButtonbuttonadd=null;
privateButtonbuttonred=null;
privateButtonbuttondiv=null;
privateButtonbuttonmul=null;
privateButtonbuttonpint=null;
privateButtonbuttonbai=null;
privateButtonbuttongen=null;
privateButtonbuttonequal=null;
privateStringx="
"
;
privateStringy="
privatedoubler1=0;
privatedoubler2=0;
privateinti=0;
@Override
protectedvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView1=(TextView)findViewById(R.id.textView1);
button1=(Button)findViewById(R.id.button1);
button2=(Button)findViewById(R.id.button2);
button3=(Button)findViewById(R.id.button3);
button4=(Button)findViewById(R.id.button4);
button5=(Button)findViewById(R.id.button5);
button6=(Button)findViewById(R.id.button6);
button7=(Button)findViewById(R.id.button7);
button8=(Button)findViewById(R.id.button8);
button9=(Button)findViewById(R.id.button9);
buttonzone=(Button)findViewById(R.id.button0);
buttonadd=(Button)findViewById(R.id.buttonadd);
buttonred=(Button)findViewById(R.id.buttonred);
buttonmul=(Button)findViewById(R.id.buttonmul);
buttondiv=(Button)findViewById(R.id.buttondiv);
buttonbai=(Button)findViewById(R.id.buttonbai);
buttongen=(Button)findViewById(R.id.buttongen);
buttonequal=(Button)findViewById(R.id.buttonequal);
buttonpint=(Button)findViewById(R.id.buttonpoint);
button1.setOnClickListener(newOnClickListener(){
@Override
publicvoidonClick(Viewarg0){
//TODOAuto-generatedmethodstub
x=x+"
1"
y=y+"
textView1.setText(y);
}
});
button2.setOnClickListener(newOnClickListener(){
2"
button3.setOnClickListener(newOnClickListener(){
3"
button4.setOnClickListener(newOnClickListener(){
4"
button5.setOnClickListener(newOnClickListener(){
5"
button6.setOnClickListener(newOnClickListener(){
6"
button7.setOnClickListener(newOnClickListener(){
7"
button8.setOnClickListener(newOnClickListener(){
8"
button9.setOnClickListener(newOnClickListener(){
9"
buttonzone.setOnClickListener(newOnClickListener(){