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]
3 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]3 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 is one way a senior employee can mentor a new employee? Give orders about what to do and what not to do Gossip about which
den301095 [7]

A good way for a senior employee to mentor a new employee is to share company knowledge and job expertise.

7 0
3 years ago
The first step in the information systems planning process is to ___________.
Basile [38]

Answer: Analyze the organization's strategic plan

Explanation:

 The initial step in the information system is to first analyze the strategic plan of the organization so that we can easily identify the main objective and challenge.

It is basically archived by enlisting the particular objective and function in the planning of information system in the organization.

All the remining option are involve in the remaining step of the information system planning not in the initial step.

Therefore, analyze the organization's strategic plan is correct as it is the first step of the information system planning.  

7 0
3 years ago
Which of the following is the BEST example of the principle of least privilege? Correct Answer: Wanda has been given access to t
pishuonlain [190]

Answer: Wanda has been given access to the files that she needs for her job.

Explanation:

The principle of least privilege is when a user is only given the minimum level of permissions that he or she needs to perform a particular job function. This helps in reducing the risk of attackers having access to data.

The best example of the principle of least privilege is Wanda has been given access to the files that she needs for her job. Given access to all of the file servers or access to all of the files on one server is incorrect.

7 0
3 years ago
A Windows computer is experiencing a problem accessing the Internet. The network patch cable and network interface card have bee
Svet_ta [14]

Answer:

The next step to consider is updating the system's network settings

Explanation:

The next step after testing and verifying that the network patch cable and network interface card are working is to update the network settings to recent configurations.

Updating the system's network include settings of network adapter, LAN / Wi-Fi and TCP/IP.

Looking into your network settings is one of steps of effectively troubleshooting a system's network.

Few settings you could update are

1. LAN settings

2. TCP/IP network protocol properties

3. Network adapter settings

4. Internet connection

Effectively, updating the network settings is the next step. Few things to take note of when updating the network settings are

1. Create Standard Configurations for Device Classifications

2. Maintain the Current and Previous Network Configurations

3. Keep Track of Changes

4. Lastly, Document Network Changes

8 0
4 years ago
In the late 1990s, Microsoft was sued for "tying" its Internet browser, Internet Explorer, to its operating system. A seller for
LekaFEV [45]

Answer:

Section 3 of the Clayton act.

Explanation:

Section 3 of the Clayton act 15 U.S.C.S § 14, makes illegal some kind of distribution practice that facilitates monopolistic arrangement that is section 3 of the Clayton act makes it illegal to enter into tying arrangement, exclusive dealing contracts or requirement contracts if such contracts tends to lessen competition. Where customer is required to pay for an undesired product in order to obtain a desired product.

3 0
3 years ago
Other questions:
  • What is the main difference between EDBAC and EDNIAC......​
    13·2 answers
  • The domain in an email message tells you what?
    11·1 answer
  • According to Gitlin, during the 1950s and 60s television production costs began to exceed the licensing fees the networks paid i
    10·1 answer
  • The text discusses three different steps when processing input. Which of the following is (are) one of those steps? (Check all t
    8·1 answer
  • Ignorance of policy is a legal excuse for an employee. TRUE or FALSE
    11·1 answer
  • Write a SELECT statement that selects all of the columns for the catalog view that returns information about foreign keys. How m
    6·1 answer
  • The computer system provides an internal clock that sends an interrupt periodically to the CPU signaling that it’s time to start
    11·1 answer
  • Select the correct answer.
    11·1 answer
  • As you continue to build the help desk, you want to ensure that all of the tools are in place and that the analysts have the too
    15·1 answer
  • A manager suspects that one of his team members has been fraudulently accessing confidential and sensitive information and breac
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!