Software Engineering class Assignment 04

Source: Internet
Author: User

Software Engineering class workGeneva

Source:

1  PackageJian;2 ImportJava.io.*;3 ImportJava.util.Scanner;4  Public classpoint3d{5      Public Static intLenght (intList[],intlenght)6     {7         intI,max;8Max=list[0];9          for(I=1;i<= (lenght-1); i++)Ten         { One             if(list[i]>max) A             { -max=List[i]; -             } the         } -         returnMax; -     } -      Public Static voidMain (string[] args) { +         //TODO auto-generated Method Stub -         intNum,max; +         intlenght; AScanner input=NewScanner (system.in); at         Try -         { -System.out.println ("Please enter an integer number:"); -lenght=input.nextint (); -             int[] list=New int[lenght]; -System.out.println ("Enter array elements:"); in              for(inti=0;i<lenght;i++) -             { tolist[i]=input.nextint (); +             } -max=lenght (list,lenght); theSystem.out.println ("The maximum value in the array element is:" +max); *         } $         Catch(Exception e)Panax Notoginseng         { -SYSTEM.OUT.PRINTLN ("Input error, input not as required!") "); the         } +     } A}

1. Positive sequence input positive integer

2. Reverse input positive integer

3. Entering a positive integer in a random order

4. Entering negative integers in random order

5. Enter an integer number of 0

6. The input has a non-integer number character

Software Engineering class Assignment 04

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.