1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Tasya [4]
3 years ago
13

Insert the missing code in the following code fragment. This fragment is intended to read an input file named dataIn.txt and wri

te to an output file named dataOut.txt.
public static void main (String[] args) throws FileNotFoundException
{
String inputFileName = "dataIn.txt";
String outputFileName = "dataOut.txt";
File inputFile = new File(inputFileName);
Scanner in = ________;
...
}
Computers and Technology
1 answer:
olasank [31]3 years ago
6 0

Answer:

new Scanner(inputFile)

Explanation:

In Java when inputting a file using Scanner class. A Scanner breaks the input into tokens with the help of delimiting patterns, by default which matches the whitespaces and then the tokens that are received may be converted into values of different types by suing different next methods.

You might be interested in
Given two integers as user inputs that represent the number of drinks to buy and the number of bottles to restock, create a Vend
Zanzabum

Answer:

import java.util.Scanner;

class Main {

 public static void main (String args[])

 {

   Scanner input = new Scanner(System.in);

   VendingMachine machine = new VendingMachine(20);

   System.out.print("Enter nr to purchase: ");

   int nrPurchased = input.nextInt();

   System.out.print("Enter nr to re-stock: ");

   int nrRestock = input.nextInt();

   machine.Transaction(nrPurchased, nrRestock);

   input.close();

 }

}

class VendingMachine {

 private int inventory;

 public VendingMachine(int initialInventory) {

   inventory = initialInventory;

 }

 public void Transaction(int nrToBuy, int nrToRestock) {

   inventory += nrToRestock - nrToBuy;

   System.out.printf("Inventory: %d bottles.\n", inventory);

 }

}

7 0
3 years ago
If I wanna records a game and my voice need to be in the video what app I download.
saveliy_v [14]
<span>Video Editor & Movie Maker App</span>
8 0
4 years ago
Read 2 more answers
Write an interactive program to calculate the volume and surface area of a three-dimensional object
Sveta_85 [38]

Answer in Python:

<em># Define program constants</em>

PI = 3.14

<em># Welcome the user to our program</em>

print("### Welcome to the Sphere Volume Calculator")

<em># Ask for the Radius (r) input and store it as a float</em>

radius = float(input("Type the Radius of your sphere in meters: "))

<em># Calculate the volume</em>

volume = 4 / 3 * PI * radius ** 3

<em># Print the result</em>

print("Your sphere volume is:", volume, "m³")

References:

  • https://www.w3schools.com/python/python_variables.asp
  • https://www.w3schools.com/python/python_casting.asp
  • https://www.w3schools.com/python/python_user_input.asp
  • https://www.w3schools.com/python/python_operators.asp
  • https://www.w3schools.com/python/ref_func_print.asp
5 0
3 years ago
It keeps saying “something is going wrong oops!” when i click on my brainly notifications what do I do
AveGali [126]

Answer:

check your app permissions it may be blocking them or try resetting the app

4 0
3 years ago
Which shortcut brings up the Print screen?
sashaice [31]

The answer is alt + prt sc

5 0
3 years ago
Read 2 more answers
Other questions:
  • Nathan, a civil engineer in a construction company, is one of the best performers in the organization. He is assigned challengin
    9·1 answer
  • Consider the problem of finding the distance between the two closest numbers in an array of n numbers. (The distance between two
    13·1 answer
  • Which of the following identifies the patterns used for each data series in a chart?
    12·1 answer
  • Will created an entry in his calendar and marks it as an all day instance which item has he created
    9·1 answer
  • It is believed that Taiwan is the original home of these early Oceania explorers. Maori Lapita Polynesians Aborigines
    13·2 answers
  • 6. When working with a file,
    9·1 answer
  • Give one advantage of saving file in the same folder<br>​
    13·2 answers
  • I am a mouse, but im not a mouse.<br><br> What am I?
    12·1 answer
  • I need to convert seconds since Unix Epoch so like the year, month, day, hour, minute, and second but I cannot figure it out. If
    14·1 answer
  • How to save an edited document.​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!