วันพฤหัสบดีที่ 19 กรกฎาคม พ.ศ. 2550

งานของสับดาห์ที่4

import java.util.*;public class xyz {
public static void main (String [] args )
{ Scanner a = new Scanner (System.in);
Scanner b = new Scanner (System.in);
Scanner c = new Scanner (System.in);
float x;
float y;
float z;
System.out.print("score1="); x = a.nextFloat();
System.out.print("score2="); y = b.nextFloat();
System.out.print("score3="); z = c.nextFloat();
System.out.println("score1= " +x);
System.out.println("score2= " +y);
System.out.println("score3= " +z);
System.out.println (("sumscore")+(x+y+z));
System.out.println (("averate")+(x+y+z)/3);
}
}
อันนี้เป็นตัวอย่างการทำงาน



import java.util.*;public class weekfour {
public static void main (String [] args )
{ Scanner a = new Scanner (System.in);
Float x;
x = a.nextFloat();
System.out.println(x);
System.out.println ("score1"+"="+ Integer.parseInt(args[0]));
System.out.println ("score2"+"="+ Integer.parseInt(args[1]));
System.out.println ("score3"+"="+ Integer.parseInt(args[2]));
System.out.println ((Integer.parseInt(args[0]))+(Integer.parseInt(args[1]))+(Integer.parseInt(args[2])));
System.out.println ((Integer.parseInt(args[0]))+(Integer.parseInt(args[1]))+(Integer.parseInt(args2]))/3.0);

}
}
อันนี้คืองานสับด่ห์ที่4

ไม่มีความคิดเห็น: