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
lianna [129]
2 years ago
7

g Create your own data file consisting of integer, double or String values. Create your own unique Java application to read all

data from the file echoing the data to standard output. After all data has been read, display how many data were read. For example, if 10 integers were read, the application should display all 10 integers and at the end of the output, print "10 data values were read" Demonstrate your code compiles and runs without issue. Respond to other student postings by enhancing their code to write the summary output to a file instead of standard output.
Computers and Technology
1 answer:
Jlenok [28]2 years ago
5 0

Answer:

See explaination

Explanation:

//ReadFile.java

import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

public class ReadFile

{

public static void main(String[] args)

{

int elementsCount=0;

//Create a File class object

File file=null;

Scanner fileScanner=null;

String fileName="sample.txt";

try

{

//Create an instance of File class

file=new File(fileName);

//create a scanner class object

fileScanner=new Scanner(file);

//read file elements until end of file

while (fileScanner.hasNext())

{

double value=fileScanner.nextInt();

elementsCount++;

}

//print smallest value

System.out.println(elementsCount+" data values are read");

}

//Catch the exception if file not found

catch (FileNotFoundException e)

{

System.out.println("File Not Found");

}

}

}

Sample output:

sample.txt

10

20

30

40

50

output:

5 data values are read

You might be interested in
What type of volcano is Dukono
ValentinkaMS [17]
Dukono is an active volcano located in the northern part of Halmahera island, Indonesia. It has a broad profile and is capped by compound craters.
8 0
2 years ago
The navigation items for a Lightning app are available on mobile: A. In a special mobile configuration in the navigation menu an
mr_godi [17]

Navigation items are used for moving from one part of the part to a destination using actions and also for passing information. The right option is  <em>C. In the navigation menu and the first four items of the </em><em>navigation bar</em><em>, when users are in the app </em>

<em />

There are different methods/ways to implement the Navigation component in a mobile application, we have the following type of Navigation Implementation

  1. Bottom Navigation
  2. Drawer Navigation(Slides from Left to right)
  3. Top Navigation

Learn more about Navigation here:

brainly.com/question/8908486

5 0
2 years ago
What formula would you enter in c4 that combines a4 and b4 to get a result like c2
Paul [167]

Available options

=A4&&B4

=A4&" "&B4

="A4"&""&"34"

=A4&""&B4

Answer:

=A4&""&B4

Explanation:

In a Microsoft Excel spreadsheet, to combine the content of two cells into another cell, a user will have to use the command &

Hence, in this case, given that there is no need to have any character or blank space in between the content of the starging cells, which is just A4 and B4, then we have the following technique

1. Select the cell C2

2. Input the command = or +, then select cell A4

3. Input the command &

4. Then select the cell B4

5. Click enter.

Therefore, the answer should appear as =A4&B4.

But from the available options, there is nothing like that, so we pick =A4&""&B4 because it gives the same outcome.

6 0
3 years ago
patty works at Mcdonald's as a chef. it is her job to make hamburgers as each order arrives on her computer screen. one day patt
il63 [147K]
Angela should make sure the hamburger patty is disposed of and a new one prepared for the hamburger. She should reprimand Patty as what she did is wrong. Patty could well be fired for what she did. It is unsafe and unsanitary to give a customer food that has fallen on the floor. Angela should make sure this never happens again.

4 0
2 years ago
Read 2 more answers
. Mercury, Venus, Earth, and Mars are the closest planets to the Sun
DIA [1.3K]

Answer:

<h3>True</h3><h2>Mercury  is the nearest</h2>

Explanation:

I hope this helps

4 0
2 years ago
Other questions:
  • Write an expression that executes the loop body as long as the user enters a non-negative number.Note: If the submitted code has
    11·1 answer
  • Driving while wearing headphones or earphones
    12·2 answers
  • A member function of a derived class may not have the same name as a member function of a base class
    9·1 answer
  • During the design phase of the systems development life cycle (SDLC), the _____ design is created for a specific platform, such
    8·1 answer
  • What was used to enhance silent films of the early 1900s
    15·1 answer
  • An article explaining the uses of the parts of a computer​
    14·1 answer
  • How many times will line 7 be executed when the following code is run?
    5·1 answer
  • What is the extension of a Microsoft access database 2013​
    7·2 answers
  • Define a function calc_pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a
    12·1 answer
  • Which of the following tasks are suitable for creating an algorithm? Choose all that apply
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!