Software Engineering Personal Assignment 01

Source: Internet
Author: User

1. Program Design Ideas

Referring to the Random class, first set 3 random numbers, 1 of which are operator random, and the other two are 0 to About integer random number that is the arithmetic of the integer. Then set 3 random numbers, one of which is the operator random number and the other two are integer random numbers from 0 to The first two random integers and the last two random integers each make up a true fraction, arithmetic the true fraction. A maximum outer cycle, the number of cycles of five times, to obtain the problem.

2. SOURCE program code

1  PackageKetang;2 3 ImportJava.util.Random;4 5  Public classSizeyunsuan {6 7      Public Static voidMain (string[] args) {8         intA1,a2,a;9Random ran=NewRandom ();Ten          for(inti=0;i<30;i++) One         { AA=ran.nextint (5); -A1=ran.nextint (100); -A2=ran.nextint (100); the             if(a==0) -System.out.println (a1+ "+" +a2+ "="); -             if(a==1) -             { +System.out.println (a1+ "-" +a2+ "="); -             } +             if(a==2) ASYSTEM.OUT.PRINTLN (a1+ "*" +a2+ "="); at             if(a==3) -             { -                  while(a2==0) -A2=ran.nextint (100); -System.out.println (a1+ "/" +a2+ "="); -             } in             if(a==4) -             { to                 intaa,a3,a4; +Aa=ran.nextint (4); -A3=ran.nextint (100); theA4=ran.nextint (100); *                 if(aa==0) $                 {Panax Notoginseng                     if(a1<a2&&a3<A4) -System.out.println (a1+ "/" +a2+ "+" +a3+ "/" +a4+ "="); the                     if(a1>a2&&a3>A4) +System.out.println (a2+ "/" +a1+ "+" +a4+ "/" +a3+ "="); A                     if(a1>a2&&a3<A4) theSystem.out.println (a2+ "/" +a1+ "+" +a3+ "/" +a4+ "="); +                     if(a1<a2&&a3>A4) -System.out.println (a1+ "/" +a2+ "+" +a4+ "/" +a3+ "="); $                     if(a1<a2&&a3==A4) $System.out.println (a1+ "/" +a2+ "+" +a3+ "/" + (a4+1) + "="); -                     if(a1>a2&&a3==A4) -System.out.println (a2+ "/" +a1+ "+" +a3+ "/" + (a4+1) + "="); the                     if(a1==a2&&a3<A4) -System.out.println (a1+ "/" + (a2+1) + "+" +a3+ "/" +a4+ "=");Wuyi                     if(a1==a2&&a3>A4) theSystem.out.println (a1+ "/" + (a2+1) + "+" +a4+ "/" +a3+ "="); -                     if(a1==a2&&a3==A4) WuSystem.out.println (a1+ "/" + (a2+1) + "+" +a4+ "/" + (a3+1) + "="); -                 } About                 if(aa==1) $                 { -                     if(a1<a2&&a3<A4) -System.out.println (a1+ "/" +a2+ "-" +a3+ "/" +a4+ "="); -                     if(a1>a2&&a3>A4) ASystem.out.println (a2+ "/" +a1+ "-" +a4+ "/" +a3+ "="); +                     if(a1>a2&&a3<A4) theSystem.out.println (a2+ "/" +a1+ "-" +a3+ "/" +a4+ "="); -                     if(a1<a2&&a3>A4) $System.out.println (a1+ "/" +a2+ "-" +a4+ "/" +a3+ "="); the                     if(a1<a2&&a3==A4) theSystem.out.println (a1+ "/" +a2+ "-" +a3+ "/" + (a4+1) + "="); the                     if(a1>a2&&a3==A4) theSystem.out.println (a2+ "/" +a1+ "-" +a3+ "/" + (a4+1) + "="); -                     if(a1==a2&&a3<A4) inSystem.out.println (a1+ "/" + (a2+1) + "-" +a3+ "/" +a4+ "="); the                     if(a1==a2&&a3>A4) theSystem.out.println (a1+ "/" + (a2+1) + "-" +a4+ "/" +a3+ "="); About                     if(a1==a2&&a3==A4) theSystem.out.println (a1+ "/" + (a2+1) + "-" +a4+ "/" + (a3+1) + "="); the                 } the                 if(aa==2) +                 { -                     if(a1<a2&&a3<A4) theSystem.out.println (a1+ "/" +a2+ "*" +a3+ "/" +a4+ "=");Bayi                     if(a1>a2&&a3>A4) theSystem.out.println (a2+ "/" +a1+ "*" +a4+ "/" +a3+ "="); the                     if(a1>a2&&a3<A4) -System.out.println (a2+ "/" +a1+ "*" +a3+ "/" +a4+ "="); -                     if(a1<a2&&a3>A4) theSystem.out.println (a1+ "/" +a2+ "*" +a4+ "/" +a3+ "="); the                     if(a1<a2&&a3==A4) theSystem.out.println (a1+ "/" +a2+ "*" +a3+ "/" + (a4+1) + "="); the                     if(a1>a2&&a3==A4) -System.out.println (a2+ "/" +a1+ "*" +a3+ "/" + (a4+1) + "="); the                     if(a1==a2&&a3<A4) theSystem.out.println (a1+ "/" + (A2+1) + "*" +a3+ "/" +a4+ "="); the                     if(a1==a2&&a3>A4)94System.out.println (a1+ "/" + (A2+1) + "*" +a4+ "/" +a3+ "="); the                     if(a1==a2&&a3==A4) theSystem.out.println (a1+ "/" + (A2+1) + "*" +a4+ "/" + (a3+1) + "="); the                 }98                 if(aa==3) About                 { -                     if(a1<a2&&a3<A4)101System.out.println (a1+ "/" +a2+ "/" +a3+ "/" +a4+ "=");102                     if(a1>a2&&a3>A4)103System.out.println (a2+ "/" +a1+ "/" +a4+ "/" +a3+ "=");104                     if(a1>a2&&a3<A4) theSystem.out.println (a2+ "/" +a1+ "/" +a3+ "/" +a4+ "=");106                     if(a1<a2&&a3>A4)107System.out.println (a1+ "/" +a2+ "/" +a4+ "/" +a3+ "=");108                     if(a1<a2&&a3==A4)109System.out.println (a1+ "/" +a2+ "/" +a3+ "/" + (a4+1) + "="); the                     if(a1>a2&&a3==A4)111System.out.println (a2+ "/" +a1+ "/" +a3+ "/" + (a4+1) + "="); the                     if(a1==a2&&a3<A4)113System.out.println (a1+ "/" + (a2+1) + "/" +a3+ "/" +a4+ "="); the                     if(a1==a2&&a3>A4) theSystem.out.println (a1+ "/" + (a2+1) + "/" +a4+ "/" +a3+ "="); the                     if(a1==a2&&a3==A4)117System.out.println (a1+ "/" + (a2+1) + "/" +a4+ "/" + (a3+1) + "=");118                 }119                  -             }121         }122     }123 124}
View Code

3. Running Results

4. Reasons for incomplete analysis in class

In class think less, think of not thoughtful.

Software Engineering Personal Assignment 01

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.