Asked by Poohboi

Okay so I am rewrite the program and it's still not coming right can anyone help me see what's going wrong here please I have to turn this in by tmw so here the program

The following program is supposed to read two numbers from a file named Ex20Input.txt, and write the sum of the number to a file named Ex20Output.dat. However, it fails to do so. Rewrite the program so that it performs correctly. (You may assume that both numbers are on the same line.)
Import Java.util.*;

public class Ch3Ex20
{
public static void main (String [] args)
{
Scanner inFile =
new Scanner (new FileReader ("Ex20Input.txt"));

Int num1, num2;

num1 = inFile.nextInt ();
num2 = inFile.nextInt ();

outFile.printIn ("Sum = " + (num1 + num2 ));

outFile.close ();
}
}
So I have change it to this way and it end up wrong still
import java.util.*;
public class Ch3Ex20
{
Scanner inFile =
new Scanner (new FileReader ("Ex20Input.txt"));

Int num1, num2;
num1 = inFile.nextInt ();
num2 = inFile.nextInt ();

PrintWrite outFile = new PrintWrite ("Ex20Output.out");

outFile.printIn ("Sum = + (num1 + num2));

outFile.close ();
}
}
So can someone help me fix this please

Answers

There are no human answers yet.
There are no AI answers yet. The ability to request AI answers is coming soon!

Related Questions