Java Calculator (pair)

Source: Internet
Author: User
Tags binary to decimal decimal to binary

One: Topic introduction

What we're going to do is a multifunction calculator,JavaThe program Editor is a comprehensive application of graphical interfaces, threads, streams, and files. The realization of graphical interface: Considering the characteristics of simplicity, practicality and efficiency, we chooseSwingto complete the implementation, on the selection component, the text editing area selects theJTextFieldas the main input and output parts, the number is selectedSwing Componentswithin theJButtonbutton, simple menu is the main choiceSwing Menusinside theJMenuthe options contained in the Control and menu are selectedSwing Menuswithin theJMenuItemand theJRadioButtonMenuItemtwo of controls. Working principle: This program can only be used after the application compiled software compiled, in the run can see the results of its display, in the use of the corresponding editing, viewing, help and so on, in the operation of the time to choose the button needed to achieve the function said need, work when you just click on the interface button,  In this program, the corresponding event response processing is performed, and the computer hardware is implemented and controlled according to the algorithm used by each module.

Two: The division of work and the process of pairing

Pair of people: Zhang Yilian and Li Fengjiao (4087) (blog address: http://www.cnblogs.com/lifengjiao/)

I am mainly responsible for components.

(1) addition of two data to add operation, can be a decimal.

(2) subtraction two data to reduce the operation, you can subtract negative numbers.

(3) Multiply two number multiplication operation.

(4) divide two number division operation.

(5) Open Square to any number of the root operation, can be a decimal.

( 6 ) The remainder is calculated for any number.

(7) The reciprocal arithmetic of any number.

(8) The conversion converts decimal numbers to binary and converts the binary into decimal.

Li Fengjiao is responsible for designing the structural framework of the calculator.

The results are as follows:

Three: Code address

Https://github.com/zhangxinn/test/blob/master/Calculator

Four. Test situation

After the code is written, check the correctness of the code, check the code after debugging and running the code will appear a javaapplet Calculator interface.  During debugging, there may be interfaces but not small programs, because there is no initialization applet, then we should initialize the applet in the main function so that the applet can run! After debugging and operation is completely correct, we can follow our own hospital to carry out a simple test of small programs, such as the input of some simple data to run each button correctly after the correct results can be initially determined by the program.  Sometimes we have to enter a different range of values to test, we may find more errors, because sometimes we define the scope of the data may be too small or the input data will be out of bounds, then we can correct to adapt to more and larger operations. Sometimes we do not consciously choose an optimal function method as far as possible to their own code simple specification without lack of the function required by the topic, it requires us to read a lot of reference books and access to a lot of information.    In fact , the layout of Javaapplet graphical interface is also the scope of our discussion, how to make the interface more beautiful is what we want to explore!

Test results such as: main interface

Situation One: Countdown

Scenario Two: Square

Case 3:2 binary to decimal

Situation four: decimal to binary binary

Five Questions and experiences

In this pair programming, encountered a lot of difficulties, but also let me know a lot of professional knowledge of programming in the top-down . gradually refinement of the algorithm has a more in-depth understanding, I study the professional knowledge more solid. At the beginning of the algorithm is not listed in the rough hands, the results found that the program code is not a little bit of discipline, and then read the textbook in some typical examples, and then slowly modify, so that the program barely meet the requirements. From this course design I found a lot of problems, but also I gained a lot of valuable experience. I also benefited from the clear division of the team.

Java Calculator (pair)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.