import java.io.FileNotFoundException;
import java.io.File;
import java.util.Scanner;
import java.io.PrintWriter;

class Nov18 {
	public static void main(String[] args) {
		
		Food f1 = new Food(100);

		Food f2 = new Food(500);
		
		System.out.println(f1.getCalories());

		Food[] foods = new Food[10];
	
		for(int i = 0; i < foods.length; i++) {
			Food f = new Food(i *100);
			foods[i] = f;
		}
		
		for(Food f : foods) {
			System.out.println(f.toString());
		}
	
		foods = new Food[10];

		File f = new File("calories.txt");
		Scanner input = null;

		try {
			input = new Scanner(f);
		}
		catch (FileNotFoundException e) {
			System.out.println("File is not found sir");
			return;
		}

		int count = 0;
		while(input.hasNext()) {
			Food f4 = new Food(input.nextInt());
			foods[count++] = f4;
		}	

		for(int i = 0; i < count; i++) {
			Food f3 = foods[i];
			System.out.println(f3.toString());
		}

		File f5 = new File("foods.txt");
		PrintWriter pw = null;

		try {
			pw = new PrintWriter(f5);
		}
		catch (FileNotFoundException e) {
			System.out.println("file not found");
			return;
		}
		
		for(int i = 0; i < count; i++) {
			Food f3 = foods[i];
			pw.println(f3.getCalories());
		}
			
		pw.close();

	}
}
