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
SVEN [57.7K]
2 years ago
13

Write a program that outputs the number of characters, words, and lines in the files that are supplied as command-line arguments

.
Computers and Technology
1 answer:
Dahasolnce [82]2 years ago
4 0
Public class Exercise_13 {

public static void main(String[] args) {

if (args.length != 1) {
System.out.println("Invalid arguments.");
System.out.println("Usage: java Chapter_12.Exercise_13 filename");
System.exit(1);
}
File filename = new File(args[0]);
if (!filename.exists()) {
System.out.println(filename + " does not exist.");
System.exit(2);
}

int characters = 0;
int words = 0;
int lines = 0;

try {
Scanner input = new Scanner(filename);
while (input.hasNext()) {
String s = input.nextLine();
lines++;
characters += s.length();
String[] split = s.split(" ");
for (String word : split) {
words++;
}
}

} catch (FileNotFoundException ex) {
ex.printStackTrace();
}

System.out.println("Characters: " + characters);
System.out.println("Words: " + words);
System.out.println("Lines: " + lines);


}
}
You might be interested in
An asymmetric encryption system utilizes how many keys?
ivanzaharov [21]
Two. One for encryption, and one for decryption. RSA is an example of an asymmetric encryption algorithm.
7 0
3 years ago
Which orientation style has more height than width?
gayaneshka [121]

Answer:

"Portrait orientation" would be the correct answer.

Explanation:

  • The vertical picture, communication as well as gadget architecture would be considered as Portrait orientation. A webpage featuring portrait orientation seems to be usually larger than large containing lettering, memo abases as well as numerous types of content publications.
  • One such volume fraction also becomes perfect for impressionism depicting an individual from either the top.

Thus the above is the correct answer.

3 0
2 years ago
What is a specific challenge faced by information visualization researchers who are building an interface?
Mkey [24]

Answer:

 Information virtualization is the process of representing the abstract data such as numeral number and text into the form of visual which is human can easily understand.

The main challenges faced by the information visualization researchers are:

  • The main challenge which are faced by the information virtualization is during the data importing and also cleaning in the system.
  • It also not able to access the large amount of the data easily from the system.
  • Due to the poor selection of the scale and the coordinate rotation it also lead to the data distortion.
3 0
3 years ago
Finish the program to compute how many gallons of paint are needed to cover the given square feet of walls. Assume 1 gallon can
Zepler [3.9K]

Answer:

The program in Python is:

Area = float(input("Area: "))

print("Gallons: "+str(Area/350.0))

Explanation:

The requirement of the program is straightforward and what is required is to divide the inputted area by 350.

Hence, the explanation is as follows:

This line prompts user for Area

Area = float(input("Area: "))

This line calculates and prints the equivalent number of gallons

print("Gallons: "+str(Area/350.0))

4 0
2 years ago
Angela's ready to get started with her first Smart Display campaign, but her account isn't yet eligible due to not having enough
Kisachek [45]

Answer:

At least 50 conversions on Display or at least 100 conversions on Search

Explanation:

Smart Display Campaigns by Google provides an intelligent and simply solution to help manage the complexities of display advertising, and is regarded as the easiest way to increase customer base and conversions. In order to set up a Smart Display Campaign, go to the Campaign tab in Google Adwords and go ahead to click on "create a new display campaign". It is important to be aware that to be eligible to run this solution, you are expected to have at least 50 conversions on display or 100 conversions on Search in the last 30 days.

3 0
3 years ago
Other questions:
  • list the version of Windows you are using XP, Windows7, Windows8 and then explain the steps you will use to find the programs
    6·1 answer
  • James, a technician, needs to format a new drive on a workstation. He will need to configure read attributes to specific local f
    5·1 answer
  • Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binar
    13·1 answer
  • What feature allows you to access previous copies of a document on OneDrive?
    15·2 answers
  • Consider the relational schema below: Students(sid: integer, sname: string, major: string) Courses(cid: integer, cname: string,
    9·1 answer
  • A data center needs to ensure that data is not lost at the system level in the event of a blackout. Servers must stay operable f
    6·1 answer
  • Which type of information could be displayed using this line graph?
    12·2 answers
  • Explain the following terms <br><br>copyleft:<br><br>creative Commons:<br><br>GNU/GPL:​
    8·1 answer
  • Another way to create a new presentation is from the Home tab
    6·2 answers
  • LaShawn would like to post photos in a social media app, but the program needs to be modified in order to display a greater vari
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!