Lab Java day 2

June 13, 2013 12:18 pm Java, Private
import java.util.Scanner;
public class Test1 {
	public static void main(String[] args) {
		//announce variable
		String name;
		int date;
		String month;
		int year;
		//input data
		System.out.print("Enter name : ");
		Scanner name1 = new Scanner (System.in);
		name = name1.nextLine();
		System.out.print("Enter Birthday Date : ");
		Scanner date1 = new Scanner (System.in);
		date = date1.nextInt();
		System.out.print("Enter Birthdat Month : ");
		Scanner month1 = new Scanner (System.in);
		month = month1.nextLine();
		System.out.print("Enter Birhday Year : ");
		Scanner year1 = new Scanner (System.in);
		year = year1.nextInt();
		//show data
		System.out.println("My Name is "+name);
		System.out.println("My Birthday is "+date+" "+month+" "+year);
 
 
	}
}
import java.util.Scanner;
//Prepare Java by Kusumoto
public class Test2 {
	public static void main(String[] args) {
		//announce variable
		int id;
		String name;
		int term1,term2,term3,term4;
		double score2,score3;
		float score4;
		//setup input data
		Scanner id1 = new Scanner (System.in);
		Scanner name1 = new Scanner (System.in);
		Scanner term1_1 = new Scanner (System.in);
		Scanner term2_1 = new Scanner (System.in);
		Scanner term3_1 = new Scanner (System.in);
		//input data
		System.out.print("Enter ID : ");
		id = id1.nextInt();
		System.out.print("Enter Name : ");
		name = name1.nextLine();
		System.out.print("Enter Score (term1) : ");
		term1 = term1_1.nextInt();
		System.out.print("Enter Score (term2) : ");
		term2 = term2_1.nextInt();
		System.out.print("Enter Score (term3) : ");
		term3 = term3_1.nextInt();
		System.out.println("-------------------------------------");
		//process data
		term4 = (term1+term2+term3)/3;
		score2 = term4;
		score3 = (term1+term2+term3)/(double)3;
		score4 = (term1+term2+term3)/(float)3;
		System.out.println("My ID is "+id);
		System.out.println("My name is "+name);
		System.out.println("My Total Score is "+(term1+term2+term3)+" point");
		System.out.println("My Average Score(int) is "+term4+" point");
		System.out.println("My Average Score(int)to(double) is "+score2+" point");
		System.out.println("My Average Score(double) is "+score3+" point");
		System.out.println("My Average Score(float) is "+score4+" point");
		//end
 
	}
}