Write a method to create a text file named numbers.txt that is to contain the whole numbers 101 to 10000 (use a for loop to write the output to the file). Write a second method that will read the data from numbers.txt and display the content to the screen (one value per line of output). Write a third method that can be used to add (sum) all of the numbers from the file and display their total on the screen – do not use an array. Write a program that includes all of the above methods. Your program must allow the user to choose if they want to create the file (first method), read & display the file content (second method), read and calculate the total from the file (third method), or exit the program. The program should continue to run until the user chooses to exit the program. Hint: When writing code for the first method you will need to consider how you will want to read the data back from the file in in the second and third method. Make sure that your Java program checks that the file exists before attempting to read from it. If the file does not exist then handle this situation by informing the user that the file does not exist and then create the file by executing the first method. b) Modify your program (and possibly the methods) so that i) the user can choose the starting and ending values to be stored in the text file ii) the user can enter the name of the file that is created by the first method iii) the user can enter the name of the file that is to be read by the second me
The post Write a method to create a text file named numbers.txt that is to contain the whole numbers 101 to 10000 (use a for loop to write the output to the file) appeared first on Best Custom Essay Writing Services | EssayBureau.com.