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
e-lub [12.9K]
3 years ago
7

Write a program that asks the user for the name of a file. The program should display the number of words that the file contains

. The file to test your program on is attached to the assignment folder. It is called Lorem.txt.
Engineering
1 answer:
Flura [38]3 years ago
3 0

Answer:

import java.io.*;

import java.util.Scanner;

public class CountWordsInFile {

   public static void main(String[] args) throws IOException {

       Scanner keyboard = new Scanner(System.in);

       System.out.print("Enter file name: ");

       String fileName = keyboard.next();

       File file = new File(fileName);

       try {

       

           Scanner scan = new Scanner(file);

           

           int count = 0;

           

           while(scan.hasNext()) {

               scan.next();

               count += 1;

           }

           scan.close();

           System.out.println("Number of words: "+count);        

       } catch (FileNotFoundException e) {

           System.out.println("File " + file.getName() + " not present ");

           System.exit(0);

       }

   }

}

You might be interested in
Pls hurry
sergey [27]

Answer:The answer is Potassium!

Explanation: This is true because each label should tell you about the available amount of a certain element. The standard order is Nitrogen-Phosphorus-Potassium. They are referred to by their standard abbreviations in the periodic table. One problem with fertilizer labels are that they are only required to disclose the amounts of macronutrients (or Nitrogen-Phosphorus-Potassium.)

5 0
3 years ago
The ???? − i relationship for an electromagnetic system is given by ???? = 1.2i1/2 g where g is the air-gap length. For current
Artemon [7]

Answer:

a) The mechanical force is -226.2 N

b) Using the coenergy the mechanical force is -226.2 N

Explanation:

a) Energy of the system:

\lambda =\frac{1.2*i^{1/2} }{g} \\i=(\frac{\lambda g}{1.2} )^{2}

\frac{\delta w_{f} }{\delta g} =\frac{g^{2}\lambda ^{3}  }{3*1.2^{2} }

f_{m}=- \frac{\delta w_{f} }{\delta g} =-\frac{g^{2}\lambda ^{3}  }{3*1.2^{2} }

If i = 2A and g = 10 cm

\lambda =\frac{1.2*i^{1/2} }{g} =\frac{1.2*2^{1/2} }{10x10^{-2} } =16.97

f_{m}=-\frac{g^{2}\lambda ^{3}  }{3*1.2^{2} }=-\frac{16.97^{3}*2*0.1 }{3*1.2^{2} } =-226.2N

b) Using the coenergy of the system:

f_{m}=- \frac{\delta w_{f} }{\delta g} =-\frac{1.2*2*i^{3/2}  }{3*g^{2} }=-\frac{1.2*2*2^{3/2} }{3*0.1^{2} } =-226.2N

8 0
3 years ago
The ___________ section of the bid package might include information concerning provisions for water and other utilities, sanita
dexar [7]

Answer:

Procurement Process

Explanation:

Procurement Process describes the series of activities that an organization partakes in to get products or services in order to achieve their goals. The choice of the procurement process is very important for the success of a construction project.

So during a bidding process, the procurement process is section where the organization will need to get water and other utilities, sanitation equipment or storage needed for the success of a construction project.

3 0
3 years ago
To read signs you need good focal vision
kow [346]

Answer:eyesight

Explanation:

7 0
3 years ago
Read 2 more answers
Find the following for an input of 120 VAC(RMS), 60 hertz, given a 10:1 stepdown transformer, and a full-wave bridge rectifier.
atroni [7]

Answer:

(i) 169.68 volt

(ii) 16.90 volt

(iii) 16.90 volt

(iv) 108.07 volt

(v) 2.161 A

Explanation:

Turn ratio is given as 10:1

We have given that input voltage v_p=120volt

(i) We know that peak voltage is give by v_{peak}=\sqrt{2}v_p=\sqrt{2}\times 120=169.68volt

(ii) We know that for transformer \frac{v_p}{v_s}=\frac{n_p}{n_s}

So \frac{169.08}{v_s}=\frac{10}{1}

v_s=16.90volt

So peak voltage in secondary will be 16.90 volt

(iii) Peak voltage of the rectifier will be equal to the peak voltage of the secondary

So peak voltage of the rectifier will be 16.90 volt

(iv) Dc voltage of the rectifier is given by v_{dc}=\frac{2v_m}{\pi }=\frac{2\times 1.414\times 120}{3.14}=108.07volt

(v) Now dc current is given by i_{dc}=\frac{v_{dc}}{R}=\frac{108.07}{50}=2.1614A

4 0
3 years ago
Other questions:
  • What is the difference between a job and a profession
    9·1 answer
  • How an AK 47 gun was works​
    14·1 answer
  • "A fluid at a pressure of 7 atm with a specific volume of 0.11 m3/kg is constrained in a cylinder behind a piston. It is allowed
    6·1 answer
  • A 40 mph wind is blowing past your house and speeds up as it flows up and over the roof. If the elevation effects are negligible
    14·1 answer
  • What is the angular velocity (in rad/s) of a body rotating at N r.p.m.?
    13·1 answer
  • Which word from the passage best explains what the web in the passage symbolizes
    10·1 answer
  • A countinous shot that sense, flows well, and is understanable and pleasant to look at
    13·1 answer
  • Workers who work with what kind of chemicals chemicals may require regular medical checkups on a more frequent basis as a result
    15·1 answer
  • What two factors are changing when the current is changed on an electric generator
    7·1 answer
  • Air at 403 K and 1 atm enters a convergent nozzle at a velocity of 150
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!