Java language Basic Experiment report second experiment

Source: Internet
Author: User
Package njtcstudent.com;

Import Java.util.Scanner; public class Seond {public static void main (string[] args) {Findmax ();///given a set of characters, the maximum number of values in the programming output reverseorder ();//per array

	After an element is assigned, output Maxtominorder () in reverse order ();//to the given integer array, output Printint () in large to small sequence (),//Given a string, the number contained in the programming output whatnumber (); Number of daffodils within//1000
		public static void Whatnumber () {int ge,shi,bai;
		int i;
			for (i=100;i<1000;i++) {bai=i/100;
			Shi= I%100/10;
			ge=i%100%10;
		if ((Math.pow (Bai, 3) +math.pow (Shi, 3) +math.pow (GE, 3)) ==i) System.out.println (i);
		 The public static void Printint () {String strthree = "sdf92r2t4h423rj23r2fj23";
		 int len = Strthree.length (); for (int i=0; i<len;i++) {if (Strthree.charat (i) >= ' 0 ' &&strthree.charat (i) <= ' 9 ') System.out.println
		 (Strthree.charat (i));
		The public static void Maxtominorder () {int[] Intarry = {1,5,7,64,87,125,75,48,96,78,56,128,47,25};
		int i,j,temp; for (i=0;i<intarry.length;i++) for (j=i+1;j<intarry.length;j++) {iF (Intarry[j]>intarry[i]) {temp=intarry[i];
					INTARRY[I]=INTARRY[J];
				Intarry[j]=temp;
			} for (i=0;i<intarry.length;i++) {System.out.print (intarry[i]+ "");
		System.out.println (); The public static void Reverseorder () {string[] Strtwo = {"Neijiang", "Shifan", "Jike", "Xueyuan", "Sofeware", "third", "C
		Lass "};
		for (int i=strtwo.length-1;i>=0;i--) {System.out.println (strtwo[i]);
		The public static void Findmax () {Scanner inputone = new Scanner (system.in);
		System.out.print ("Please enter a character:");
		String Strlone;
		Strlone = Inputone.next ();
		int Max=strlone.charat (0);
		int i;
		For (I=1;i<strlone.length (); i++) {if (Max<strlone.charat (i)) Max=strlone.charat (i);
	System.out.println ("The max value is:" + (char) max);
 }

}

This one in Class 2 and 3.





The second experiment report of Class 4, which only made the fourth one, I wrote as follows:

Package Com.njtcstudent.javademo;

Import Java.util.Scanner;

public class Wuliantwo {public

	static void Main (string[] args) {a
		();//Select branch structure that
		second ();//loop structure that

}
	private static void second () {
		int i,s=1;
		for (i=10;i>=1;i--)
		{
			s=s*i;
			System.out.println (i);
		}
		System.out.println ("10"). Value is: "+s);
	}
	private static void A () {
		Scanner myin = new Scanner (system.in);
		System.out.println ("Please enter a score (hundred):");
		int gread;
		Gread = Myin.nextint ();
		if (gread>=0 && gread<=100) {
			gread=gread%10;
			
			Switch (gread) {case
			10:case 9:
				System.out.println ("A");
				break;
			Case 8:
				System.out.println ("B");
				break;
			Case 7:
				System.out.println ("C");
				break;
			Default:
				System.out.println ("E");
				
			}
		else
			System.out.println ("You have entered a wrong grade. ");
	}
	
}
	


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.