+ 1
Can you guys tell what missing in my code i make rawData.txt file and it still give me erro not get nothing in vita
import java.util.Scanner;//did not work import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; public class ReadAndWrite { public static void main(String [] args) throws FileNotFoundException { Scanner diskScanner = new Scanner(new File("rawData.txt")); PrintStream diskWriter = new PrintStream("vita.txt"); double unitPrice, quantity,total; unitPrice = diskScanner.nextDouble(); quantity = diskScanner.nextInt(); total = unitPrice * quantity; diskWriter.println(total); diskScanner.close(); diskWriter.close(); } }
1 Réponse