Cod sursa(job #1833138)

Utilizator AndreidgDragomir Andrei Valentin Andreidg Data 21 decembrie 2016 19:28:41
Problema A+B Scor 0
Compilator java Status done
Runda Arhiva de probleme Marime 0.82 kb
import java.io.*;
import java.util.*;

public class Numere {
	
	public int a,b;
	
	public int getA(int a) {
		return a;
	}
	
	public int getB(int b) {
		return b;
	}
	
	public void setA(int a) {
		this.a=a;
	}
	
	public void setB(int b) {
		this.b=b;
	}
	
	public int sum(int a,int b) {
		return (a + b);
	}
	public static void main(String[] args) throws IOException{
		
		File f1 = new File("adunare.in");
		//System.out.println(f1.getAbsolutePath());
		if(!f1.canRead()){
			System.out.println("ERROR");
			return ;
		}
		Scanner fr = new Scanner(f1);
		
		int s;
		Numere x = new Numere();
		x.setA(fr.nextInt());
		x.setB(fr.nextInt());
		fr.close();
		s=x.sum(x.a,x.b);
		
		PrintWriter wr = new PrintWriter("adunare.out");
		wr.write(new Integer(s).toString());
		wr.close();
	}

}