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
Water flows around a 6-ft diameter bridge pier with a velocity of 12 ft/s. Estimate the force (per unit length) that the water e
jolli1 [7]

Answer: hello the diagram related to your question is missing please the third image is the missing part of the question

Fx = 977.76 Ib/ft

Explanation:

<u>Estimate the force that water exerts on the pier </u>

V = 12 ft/s

D( diameter ) = 6 ft

first express the force  on the first half of the cylinder  as

Fx1 =  - -2\int\limits^\pi _\frac{\pi }{2}   {Ps*cos\beta *a} \, d\beta   ---------------- ( 1 )

where ; Fy = 0

Ps = Po + 1/2 Pv^2 ( 1 - 4 sin^2β )  ------------- ( 2 )

Input equation (2)  into equation ( 1 )         (note :  assuming Po = 0 )

attached below is the remaining part of the solution

3 0
3 years ago
Suppose the loop is moving toward the solenoid (to the right). Will current flow through the loop down the front, up the front,
Tems11 [23]

Answer:

See explanation

Explanation:

The magnetic force is

F = qvB sin θ

We see that sin θ = 1, since the angle between the velocity and the direction of the field is 90º. Entering the other given quantities yields

F

=

(

20

×

10

−

9

C

)

(

10

m/s

)

(

5

×

10

−

5

T

)

=

1

×

10

−

11

(

C

⋅

m/s

)

(

N

C

⋅

m/s

)

=

1

×

10

−

11

N

6 0
3 years ago
Read 2 more answers
Air expands through a turbine operating at steady state. At the inlet p1 = 150 lbf/in^2, T1 = 1400R and at the exit p2 = 14.8 lb
Paraphin [41]

Answer:

The power developed in HP is 2702.7hp

Explanation:

Given details.

P1 = 150 lbf/in^2,

T1 = 1400°R

P2 = 14.8 lbf/in^2,

T2 = 700°R

Mass flow rate m1 = m2 = m = 11 lb/s Q = -65000 Btu/h

Using air table to obtain the values for h1 and h2 at T1 and T2

h1 at T1 = 1400°R = 342.9 Btu/h

h2 at T2 = 700°R = 167.6 Btu/h

Using;

Q - W + m(h1) - m(h2) = 0

W = Q - m (h2 -h1)

W = (-65000 Btu/h ) - 11 lb/s (167.6 - 342.9) Btu/h

W = (-65000 Btu/h ) - (-1928.3) Btu/s

W = (-65000 Btu/h ) * {1hr/(60*60)s} - (-1928.3) Btu/s

W = -18.06Btu/s + 1928.3 Btu/s

W = 1910.24Btu/s

Note; Btu/s = 1.4148532hp

W = 2702.7hp

5 0
3 years ago
3. Low-voltage conductors rarely cause<br> injuries.
hram777 [196]
True
the answer to this would be true
8 0
2 years ago
A sports car has a drag coefficient of 0.29 and a frontal area of 20 ft2, and is travelling at a speed of 120 mi/hour. How much
Andrej [43]

Answer:

Power required to overcome aerodynamic drag is 50.971 KW

Explanation:

For explanation see the picture attached

4 0
3 years ago
Other questions:
  • A manufacturer makes two types of drinking straws: one with a square cross-sectional shape, and the other type the typical round
    9·1 answer
  • The evaporator section of a refrigeration unit consists of thin-walled, 10-mm-diameter tubes through which refrigerant passes at
    7·1 answer
  • How much work is performed if a 400 lb weight is lifted 10 ft ?
    8·1 answer
  • Write analgorithm and a C code to calculate the sum and average value of an array12elements.For example: Array_Temperaure=[10, 1
    6·1 answer
  • Pls help! 39 points!!
    5·2 answers
  • In the ______ phase of the organizational life cycle, the organization is usually very small and agile, focusing on new products
    8·1 answer
  • Which type of finish is absorbed into the wood?
    7·1 answer
  • The coefficient of performance of a reversible refrigeration cycle is always (a) greater than, (b) less than, (c) equal to the c
    12·1 answer
  • A series RC circuit has a voltage of 24VAC and an impedance of 252ohms. What is the circuit current?
    6·1 answer
  • Javier’s class visited a power plant near his city, and they learned how it produced electricity. What does this form of power d
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!