基于java的简易计算器的设计
摘要
自从java语言诞生以来,java语言就以不可抵挡的趋势很快成为国际上广泛流行的面向对象编程语言,它既具有高级语言的特点,又少了C语言中指针特点,因而变得简单了很多。Java是一种可以撰写跨平台应用软件的面向对象的程序设计语言,其具有卓越的通用性、高效性、平台移植性和安全性,广泛应用于个人PC、数据中心、游戏控制台、科学超级计算机、移动电话和互联网,同时拥有全球最大的开发者专业社。在全球云计算和移动互联网的产业环境下,Java更具备了显著优势和广阔前景。
本文介绍了用java语言编写一个简易计算器。实现数学上的加、减、乘、除、乘方、开方、阶乘、正弦、余弦运算等相关运算。利用这个程序可以方便的进行日常性的小规模运算,小巧简易,是个实用的工具。
关键词:程序设计;简易计算器;java语言
THE DESIGN OF SIMPLE CALCULATOR BASED ON JAVA
ABSTRACT
Since the inception of the java language, java language Take irresistible trend soon became widespread international popular object-oriented programming language, both with advanced language features, and less of the C language pointer characteristics, and thus becomes a lot simpler . Java is a cross-platform application software can write object-oriented programming language, which has excellent versatility, efficiency, platform portability, and security, are widely used in personal PC, data center, gaming consoles, scientific super-computers, mobile phones and the Internet, also has the world's largest developer of professional community. In the global cloud computing and mobile Internet industry environment, Java and more have significant advantages and broad prospects.
This article describes the use java language a simple calculator. Achieve mathematical addition, subtraction, multiplication, division, involution, evolution, factorial, sine, cosine operations and other related operations. With this program you can easily carry out daily operations of small-scale, small simple, is a useful tool.
Key words: program design; simple calculator; java language
1 前言…………………..………………...............……………….………………………….1
1.1 课程设计背景……………………....用java编写一个简单的计算器…………………………………………………1
1.2 需求环境………………………............………………………………………………1
1.3 课程设计思路………………….………………...……………………………………1
2 课程设计概要………......................................................…………………………………...….2
3 计算器详细设计 ………………….........................................………………..……….....3
3.1 计算器界面 ……….………….........………………………………………. .3
3.1.1 CAL主类的显示分布…………………………………...…………………….3
3.1.2计算器显示界面实现代码 ………….…………………………………… 3
3.2 监听各个按钮的类………………...............................…….………………………..5
3.2.1 编写监听类目的………………………………………………………….…...5
3.2.2 监听类实现代码……………………....................………………………....…5
3.3 按键响应类…………………….………...........................................………………..7
3.3.1 响应类编写的目的………………………………...................………….…...7
3.2.2 响应类实现代码……………........................……………………………....…7
3.3 运算处理类…………………….……...........................................…………………..9
3.3.1 处理方式 . …………………................................……………………….…...9
3.2.2 处理类实现代码……………………....................………………………....…9
4 运行与调试…………..………………...............……………….………………………12
4.1 进入程序主界面 ………………..…....….......……………………………………12
4.2 加减乘除功能实现………..........….........……….......……………………………12
4.3 正余弦、正切功能实现…………….........……...…………………………………13
4.4 阶乘功能实现………......................…………………....…………………………13
4.5 乘方、开方功能实现…………….........……...…………....………………………14
5 实验总结…...........…………………………………………………………………...15
参考文献………………………………………………………………………….……..16
附录:源代码 ………………………………………………………………….……………..17
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论