20165219 2017-2018-2 "Java programming" a first week summary of pair programming

Source: Internet
Author: User
Tags cloud hosting

20165219 2017-2018-2 "Java programming" pair programming first week summary pair object

20165219 Wang Yanbo

20165232 He Yanda

Demand analysis

Implement a program that requires:

1 Support for integer operations

2 support for multi-operator operations

3 support fractional operation, support true fractional operation

3 statistic correct rate

Expansion requirements:

Design ideas

This is a program that needs to support complex operations, unlike simple single-operator arithmetic, you need to design multiple classes to implement operations such as subtraction and squared operations.

NML Chart (partial)

Code Progress

Integer Calculation class

public class IntNumber {    private int A;    public int getA(){        return A;    }    public IntNumber(int A){        this.A = A;    }    public int add(IntNumber op1){        int sum = A + op1.A;        System.out.print(A + " + " + op1.A + "=");        return sum;    }    public int subtract(IntNumber op1){        int num = A - op1.A;        System.out.print(A + " - " + op1.A + "=");        return num;    }    public int multiply(IntNumber op1){        int num = A * op1.A;        System.out.print(A + " * " + op1.A + "=");        return num;    }    public static IntNumber obj(){        Random ran = new Random();        return new IntNumber(ran.nextInt(20)-10);    }    public String divide(Score op1){        System.out.print(op1.getNumerator() + " / " + op1.getDenominator() + "=");        return op1.toString();    }}

Code Cloud Hosting

Function

Test of normal boundary anomaly

Knot to feel

Pair learning or need to have a clear division of labor to play a multiplier effect, through this week's knot to learn, you can feel the effect of 1+1>2.

20165219 2017-2018-2 "Java programming" a first week summary of pair programming

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.