QuestionQuestion

Question 1:
Write a program to read from a file “input4_01.txt” an integer N (0≤ N ≤ 100) and then read N double numbers from this file to an array. Write to file “output4_01.txt” the maximum number of the array. For example
File: “input4_01.txt”
5
1.30 2.22 4.00 17.60 3.14
File “output4_01.txt”
17.60


Question2: Write a program to read from a file “input4_02.txt” an integer N (0≤ N ≤ 100) and then read N double numbers from this file to an array. Write to file “output4_02.txt” this array but in the reverse order and also the sum of all elements in the array. For example
File: “input4_02.txt”
5
1.30 2.22 4.00 17.60 3.14
File “output4_02.txt”
3.14 17.60 4.00 2.22 1.30
Sum = 28.26

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

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

public class Question1 {

public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException
{
PrintWriter writer = new PrintWriter("output4_01.txt", "UTF-8");
Scanner input = new Scanner(new File("input4_01.txt"));
int count = input.nextInt();
double[] nums = new double[count];
double max = 0;
for(int i = 0; i < count; i++)
{...
$20.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats