anonymous No title
Java
class ExStudent{
	static int Cnt;
	int Stno = 1000; //Student number
	String name;
	int GRD; //Grade
	String DPM; //Department
	int RPT[]; // array of "Report"

	ExStudent(){
		Cnt++;
		Stno += Cnt;
		name = "";
		GRD = 1;
		DPM = "mi";
		RPT = new int[3];
		for (int i = 0; i < 3; i++) RPT[i] = 0;
	}

	ExStudent(String N, int G, String D){
		Cnt++;
		Stno += Cnt;
		name = N;
		GRD = G;
		DPM = D;
		RPT = new int[3];
		for (int i = 0; i < 3; i++) RPT[i] = 0;
	}

	static int getCnt(){ //Get "Cnt"
		return Cnt;
	}
	int getStno(){ //Get "Student Number"
		return Stno;
	}
	void setName(String a){ // Set "Student Name"
		name = a;
	}
	String getName(){ //Get Current "Student Name"
		return name;
	}
	void setGRD(int a){ //Set "Grade"
		GRD = a;
	}
	int getGRD(){ //Get Current "Grade"
		return GRD;
	}
	void setDPM(String a){ //Set "Department"
		DPM = a;
	}
	String getDPM(){ //Get Student's "Department"
		return DPM;
	}
	void setSOR(int no, int score){ //Set "Score of Report"
		RPT[no-1] = score;
	}
	int getSOR(int no){
		return RPT[no-1];
	}
	float getAVG(){ //Get "Average of Scores"
		float tmp = 0;
		for (int i = 0; i < 3; i++){
			tmp += RPT[i];
		}
		return (tmp/3);
	}

	public static void main(String args[]){
		Stdin sin = new Stdin();
		System.out.print("何人の学生がいますか > ");
		int N = sin.geti();
		ExStudent s[] = new ExStudent[N];
		for (int i = 0; i < N; i++){
			System.out.print("\n" + (i+1) + "人目の氏名・学年・学科を教えてください。\n");
			System.out.print("氏名 > ");
			String NAME = sin.gets();
			System.out.print("学年 > ");
			int Grade = sin.geti();
			System.out.print("学科 > ");
			String Department = sin.gets();
			s[i] = new ExStudent(NAME, Grade, Department);
			System.out.println("\n" + "次に" + NAME + "さんのレポートの成績を教えてください。");
			for (int j = 0; j < 3; j++){
				System.out.print(j+1 + "回目 > ");
				int SC = sin.geti();
				s[i].setSOR(j+1, SC);
			}
			
		}

		System.out.println("受講者数:" + getCnt());
		
		for (int i = 0; i < getCnt(); i++){
			System.out.println();
			System.out.println("受講者番号:" + s[i].getStno() + " 氏名:" + s[i].getName() + " " + s[i].getGRD() + "年 " + s[i].getDPM());
			System.out.println("平均" + String.format("%.1f", s[i].getAVG()) + "点 " + "1回目:" + s[i].getSOR(1) + ", 2回目:" + s[i].getSOR(2) + ", 3回目:" + s[i].getSOR(3));
		}
	}
}
anonymous No title
Java
class Student{
	static int Cnt;
	int Stno = 1000; //Student number
	String name;
	int GRD; //Grade
	String DPM; //Department
	int RPT[]; // array of "Report"

	Student(){
		Cnt++;
		Stno += Cnt;
		name = "";
		GRD = 1;
		DPM = "mi";
		RPT = new int[3];
		for (int i = 0; i < 3; i++) RPT[i] = 0;
	}

	Student(String N, int G, String D){
		Cnt++;
		Stno += Cnt;
		name = N;
		GRD = G;
		DPM = D;
		RPT = new int[3];
		for (int i = 0; i < 3; i++) RPT[i] = 0;
	}

	static int getCnt(){ //Get "Cnt"
		return Cnt;
	}
	int getStno(){ //Get "Student Number"
		return Stno;
	}
	void setName(String a){ // Set "Student Name"
		name = a;
	}
	String getName(){ //Get Current "Student Name"
		return name;
	}
	void setGRD(int a){ //Set "Grade"
		GRD = a;
	}
	int getGRD(){ //Get Current "Grade"
		return GRD;
	}
	void setDPM(String a){ //Set "Department"
		DPM = a;
	}
	String getDPM(){ //Get Student's "Department"
		return DPM;
	}
	void setSOR(int no, int score){ //Set "Score of Report"
		RPT[no-1] = score;
	}
	int getSOR(int no){
		return RPT[no-1];
	}
	float getAVG(){ //Get "Average of Scores"
		float tmp = 0;
		for (int i = 0; i < 3; i++){
			tmp += RPT[i];
		}
		return (tmp/3);
	}

	public static void main(String args[]){
		Stdin sin = new Stdin();
		Student s[] = new Student[5];
		s[0] = new Student("高専太郎", 1, "ms");
		s[1] = new Student("沖縄次郎", 3, "ic");
		s[2] = new Student("高専花子", 4, "mi");
		s[3] = new Student("名護三郎", 1, "br");
		s[4] = new Student("高専哲郎", 1, "mi");

		//about s0
		s[0].setSOR(1, 60);
		s[0].setSOR(2, 70);
		s[0].setSOR(3, 80);

		//about s1
		s[1].setSOR(1, 0);
		s[1].setSOR(2, 70);
		s[1].setSOR(3, 60);

		//about s2
		s[2].setSOR(1, 80);
		s[2].setSOR(2, 0);
		s[2].setSOR(3, 75);

		//about s3
		s[3].setSOR(1, 70);
		s[3].setSOR(2, 50);
		s[3].setSOR(3, 90);

		//about s4
		s[4].setSOR(1, 90);
		s[4].setSOR(2, 85);
		s[4].setSOR(3, 80);

		System.out.println("受講者数:" + getCnt());
		
		for (int i = 0; i < getCnt(); i++){
			System.out.println();
			System.out.println("受講者番号:" + s[i].getStno() + " 氏名:" + s[i].getName() + " " + s[i].getGRD() + "年 " + s[i].getDPM());
			System.out.println("平均" + String.format("%.1f", s[i].getAVG()) + "点 " + "1回目:" + s[i].getSOR(1) + ", 2回目:" + s[i].getSOR(2) + ", 3回目:" + s[i].getSOR(3));
		}
	}
}
anonymous No title
Java
class random1{
	public static void main(String args[]){
		double a = Math.random();
		System.out.println(a);
		int RDM = (int)(Math.random() * 100);
		System.out.println(RDM);
	}
}
anonymous No title
Java
package datashori;

import java.io.IOException;

public class shimon10 {

	public static void main(String[] args) {


	try {

		ProcessBuilder p = new ProcessBuilder("C:\\workspace\\datashori\\libsvm-3.24\\libsvm-3.24svm-train.c","-v3","C:\\workspace\\datashori\\rakuten1.file");
		p. redirectErrorStream(true);
		p.start();

         }catch(IOException e) {

        	 e.printStackTrace();

         }
}
}
anonymous No title
Java
package datashori;

import java.io.File;
import java.io.IOException;

public class shimon10 {

	public static void main(String[] args) {


	try {

		ProcessBuilder p = new ProcessBuilder("C:\\workspace\\datashori\\libsvm-3.24\\libsvm-3.24svm-train.c","-v3","cd");
		p. redirectErrorStream(true);
		p.start();

         }catch(IOException e) {

        	 e.printStackTrace();

         }
}
}
anonymous No title
Java
【レフェリークラス】
class Practice2_02_1_referee{
	
	//------フィールド-------
	private String name ;
	
	//------コンストラクタ------
	Practice2_02_1_referee( String nm ){
		this.name = nm ;
	}
	
	//------メソッド-------
	
	//declareHandStatusメソッド
	public void declareHandStatus( Practice2_02_1_player player1,Practice2_02_1_player player2 ){
		System.out.println( "審判" + this.name + ":「" + player1.getName() + "さんの手は" + player1.getHandStatus() + "でした!!」" );
		System.out.println( "審判" + this.name + ":「" + player2.getName() + "さんの手は" + player2.getHandStatus() + "でした!!」" );
	}
	
	//judgeGameメソッド
	public void judgeGame( Practice2_02_1_player player1,Practice2_02_1_player player2 ){
		
		if(player1.getHandStatus().equals(player2.getHandStatus())){
			
			System.out.println( "審判" + this.name + ":「あいこ!勝負つかず!!!」" ) ;
			
		}else if(((player1.getHandStatus().equals("グー"))&&(player2.getHandStatus().equals("チョキ")))||((player1.getHandStatus().equals("パー"))&&(player2.getHandStatus().equals("グー")))||((player1.getHandStatus().equals("チョキ"))&&(player2.getHandStatus().equals("パー")))){		
			
			System.out.println( "審判" + this.name + ":「" + player1.getName() + "さんの勝ち」" ) ;
			
		}else if(((player2.getHandStatus().equals("グー"))&&(player1.getHandStatus().equals("チョキ")))||((player2.getHandStatus().equals("パー"))&&(player1.getHandStatus().equals("グー")))||((player2.getHandStatus().equals("チョキ"))&&(player1.getHandStatus().equals("パー")))){
			
			System.out.println( "審判" + this.name + ":「" + player2.getName() + "さんの勝ち」" ) ;
			
		}
	}
	
	//-----getter/setter-------
	public String getName(){
		return this.name;
	}
	public void setName(){
		this.name = name ;
	}
	
}


anonymous No title
Java
【プレイヤークラス】
import java.util.Random;

class Practice2_02_1_player{
	
	//-------フィールド------
	private String name ;
	private String handStatus ;
	
	//-------コンストラクタ--------
	Practice2_02_1_player( String nm ){
		this.name = nm ;
	}
	
	//-------メソッド---------
	public void makeHandStatus(){
		String[] makeHands = { "グー","チョキ","パー" };
		
		Random rnd = new Random();
		this.handStatus = makeHands[rnd.nextInt(3)] ;
	}
	
	//-------getter/setter--------
	
	public String getName(){
		return this.name ;
	}
	public void setName(){
		this.name = name ;
	}
	
	public String getHandStatus(){
		return this.handStatus ;
	}
	public void setHandStatus(){
		this.handStatus = handStatus ;
	}
	
}
anonymous No title
Java
【メインクラス】
class Practice2_02_1_janken{
	public static void main(String[] args){
		
		//------シナリオ①---------
		String player1_nm = args[0] ;
		String player2_nm = args[1] ;
		String judgement_nm = args[2] ;
		
		//------シナリオ②---------
		Practice2_02_1_player player1 = new Practice2_02_1_player( player1_nm );
		Practice2_02_1_player player2 = new Practice2_02_1_player( player2_nm );
		Practice2_02_1_referee referee = new Practice2_02_1_referee( judgement_nm );
		
		//------シナリオ③---------
		System.out.println( "審判" + referee.getName() + ":「ジャンケン…ポン!!!!!」" ) ;
		player1.makeHandStatus();
		player2.makeHandStatus();
		referee.declareHandStatus( player1,player2 );
		
		//------シナリオ④---------
		System.out.println( "審判" + referee.getName() + ":「結果は……」" );
		referee.judgeGame( player1,player2 );
		
	}
}
anonymous No title
Java
package datashori;

public class MyClass7 {


	public static void main(String args[]) {
		person4 p1 = new person4();
		System.out.println(p1.getAge());
		p1.shoesAvarage(p1.getShoes(),p1.getAge());
}
}



anonymous No title
Java
package datashori;

public class person4 extends person1 {
	private String kamoku;
	public String getKamoku() {
		return kamoku;
	}
	public void setKamoku(String kamoku) {
		this.kamoku = kamoku;
	}

	public void setAge(int age) {
		if(age<20) {
			System.out.println("Error!");
		}else {
			super.setAge(age);
		}
	}
	person4(){
		setName("狩野");
		setAge(22);
		setHeight(170);
		setShoes(20);
		setKamoku("プログラミング");
	}
}
Don't you submit code?
Submit