RIGHT-BICEP Requirements for designing unit test cases for arithmetic 2 programs

Source: Internet
Author: User

Changes after the code (part) other unchanged

 Public Static voidMain (String args[]) {Scanner in=NewScanner (system.in); intPrintnumber=0,boolchengchu=0,boolbrackets=0,mathnumber=0, MaxNumber=0,boolnegative=0,boolremainder=0; Try{System.out.print ("Print quantity is (positive integer)"); Printnumber=In.nextint (); if(printnumber<=0) {System.out.print ("Print quantity input does not conform to standard"); System.exit (0); } System.out.print ("Number of operands (positive integers)"); Mathnumber=In.nextint (); if(mathnumber<2) {System.out.print ("The number of operands entered does not conform to the standard"); System.exit (0); } System.out.print ("Is there a multiplication method (0 No 1 is)"); Boolchengchu=In.nextint (); if(boolchengchu>1| | Boolchengchu<0) {System.out.print ("Input non-conformance criteria"); System.exit (0); } System.out.print ("Is there a parenthesis (0 No 1 is)"); Boolbrackets=In.nextint (); if(boolbrackets>1| | Boolbrackets<0) {System.out.print ("Input non-conformance criteria"); System.exit (0); } System.out.print ("Maximum value is:"); MaxNumber=In.nextint (); if(maxnumber<=0) {System.out.print ("Input non-conformance criteria"); System.exit (0); } System.out.print ("Plus minus negative (0 No 1 is):"); Boolnegative=In.nextint (); if(boolnegative>1| | Boolnegative<0) {System.out.print ("Input non-conformance criteria"); System.exit (0); } System.out.print ("Division has no number (0 No 1 is)"); Boolremainder=In.nextint (); if(boolremainder>1| | Boolremainder<0) {System.out.print ("Input non-conformance criteria"); System.exit (0); }        }        Catch(inputmismatchexception e) {System.out.print ("Input non-conformance criteria"); System.exit (0); }         for(inti=0;i<printnumber;i++) {Automatic automac; Automac=NewAutomatic (Mathnumber,boolchengchu,boolbrackets,maxnumber,boolnegative,boolremainder); System.out.println (""); }                                }

Correctly entered results

Enter Non-integer

Number of inputs out of bounds

The input is an integer but the greater the number of int bounds is written a large test program will not die, the result is not dead all is a number over the minimum lower bound int.

RIGHT-BICEP Requirements for designing unit test cases for arithmetic 2 programs

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.