Java Course Design

Source: Internet
Author: User

Java Course design one, Topic Introduction Calculator Simulation Program (2 people) score factor: D

Functional Requirements: modeled after the Windows Calculator, write a calculator with GUI, can implement integer addition, subtraction, multiplication, except arithmetic, and need to support keyboard shortcut, basically can replace the Windows calculator. Support Copy, paste function, easy to enter long string of numbers.
The interface display can be referenced. Previous calculations need to be stored in the file, and the next start can be reused. function specific Reference Windows Calculator (View menu selection: Standard, history (to achieve this level of promotion))

Bonus points: more functions (conversion), more beautiful interface, more convenient operation, support parsing arithmetic expression, support for large number of addition and subtraction, support to save and read the results of the operation. or multi-threading to provide network computing services.

Second, team members and Task allocation table

Third, the design process product interface

System flowchart

system function diagram

Main function Design

Binary conversion
Using the integer tobinarystring method and the Tooctalstring method to achieve the conversion, but we define the Resultnumber is a double type, so we must first convert the resultnumber to int, and then use two methods, Finally, the double valueof method is used to assign the value to Resultnumber.

Precision Implementation
Floating-point calculations are imprecise, and the BigDecimal class can be used to achieve accurate calculations, which are required in several of the operations mentioned above. Use string.valueof to convert the double type to string, then the new BigDecimal object, and then use BigDecimal's add, subtract, and multiply methods.

Iv. git commit Lin Junwei

Link

Cheng

Code link
. jar Package Links

V. Summary of the course setting

This Java Lesson Set Calculator interface is more beautiful, the basic function is more complete, the biggest bright spot lies in the consummation of the precision and the realization of the conversion, also can save the result of the previous operation, can realize the copy and paste of the big string data inside and outside; regret and insufficiency is to fail to implement long string operation expression, can only repeated operation, Algorithm priority operation failed to implement Use keyboard input. 0123456789 also failed to achieve, several times to study KeyListener and try to write the corresponding code, some errors have not been resolved, and then choose to give up; Through this session, I have a more in-depth understanding of interface design and swing components, resulting in more sophisticated computational thinking, but to create an expression (Stack's cognition still needs to be strengthened), the research of the keyboard mouse listener still needs to be deepened.

Java Course Design

Related Article

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.