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
What does it mean when it says technology is A dynamic process
Degger [83]

Answer:

It studies the process of technological change. Under the field of Technology Dynamics the process of technological change is explained by taking into account influences from "internal factors" as well as from "external factors

Explanation:

5 0
3 years ago
How do you make coke for steel?
stich3 [128]
Can you be a bit more specific plz and that will let me identify the answer
6 0
3 years ago
For methyl chloride at 100°C the second and third virial coefficients are: B = −242.5 cm 3 ·mol −1 C = 25,200 cm 6 ·mol −2 Calcu
bogdanovich [222]

Answer:

a)W=12.62 kJ/mol

b)W=12.59 kJ/mol

Explanation:

At T = 100 °C the second and third virial coefficients are

B = -242.5 cm^3 mol^-1

C = 25200 cm^6  mo1^-2

Now according isothermal work of one mole methyl gas is

W=-\int\limits^a_b {P} \, dV

a=v_2\\

b=v_1

from virial equation  

\frac{PV}{RT}=z=1+\frac{B}{V}+\frac{C}{V^2}\\   \\P=RT(1+\frac{B}{V} +\frac{C}{V^2})\frac{1}{V}\\

And  

W=-\int\limits^a_b {RT(1+\frac{B}{V} +\frac{C}{V^2}\frac{1}{V}  } \, dV

a=v_2\\

b=v_1

Now calculate V1 and V2 at given condition

\frac{P1V1}{RT} = 1+\frac{B}{v_1} +\frac{C}{v_1^2}

Substitute given values P_1\\ = 1 x 10^5 , T = 373.15 and given values of coefficients we get  

10^5(v_1)/8.314*373.15=1-242.5/v_1+25200/v_1^2

Solve for V1 by iterative or alternative cubic equation solver we get

v_1=30780 cm^3/mol

Similarly solve for state 2 at P2 = 50 bar we get  

v_1=241.33 cm^3/mol

Now  

W=-\int\limits^a_b {RT(1+\frac{B}{V} +\frac{C}{V^2}\frac{1}{V}  } \, dV

a=241.33

b=30780

After performing integration we get work done on the system is  

W=12.62 kJ/mol

(b) for Z = 1 + B' P +C' P^2 = PV/RT by performing differential we get  

         dV=RT(-1/p^2+0+C')dP

Hence work done on the system is  

W=-\int\limits^a_b {P(RT(-1/p^2+0+C')} \, dP

a=v_2\\

b=v_1

by substituting given limit and P = 1 bar , P2 = 50 bar and T = 373 K we get work  

W=12.59 kJ/mol

The work by differ between a and b because the conversion of constant of virial coefficients are valid only for infinite series  

8 0
3 years ago
A sample of sand weighs 490 g in stock and 475 in Oven Dry (OD) condition, respectively. If absorption capability of the sand is
Ivahew [28]

The weight of the specimen in SSD condition is 373.3 cc

<u>Explanation</u>:

a) Apparent specific gravity = \frac{A}{A-C}

Where,

A = mass of oven dried test sample in air = 1034 g

B = saturated surface test sample in air = 1048.9 g

C = apparent mass of saturated test sample in water = 975.6 g

apparent specific gravity = \frac{A}{A-C}

                                         = \frac{1034}{1034-675 \cdot 6}

Apparent specific gravity = 2.88

b) Bulk specific gravity G_{B}^{O D}=\frac{A}{B-C}

G_{B}^{O D}=\frac{1034}{1048.9-675 \cdot 6}

       =  2.76

c) Bulk specific gravity (SSD):

G_{B}^{S S D}=\frac{B}{B-C}

=\frac{1048 \cdot 9}{1048 \cdot 9-675 \cdot 6}

G_{B}^{S S D} = 2.80

d) Absorption% :

=\frac{B-A}{A} \times 100 \%

=\frac{1048 \cdot 9-1034}{1034} \times 100

Absorption = 1.44 %

e) Bulk Volume :

v_{b}=\frac{\text { weight of dispaced water }}{P \omega t}

=\frac{1048 \cdot 9-675 \cdot 6}{1}

= 373.3 cc

5 0
3 years ago
The end of a large tubular workpart is to be faced on a NC vertical boring mill. The part has an outside diameter of 38.0 in and
nata0808 [166]

Answer:

(a) the cutting time to complete the facing operation = 11.667mins

b) the cutting speeds and metal removal rates at the beginning= 12.89in³/min and end of the cut. = 8.143in³/min

Explanation:

check attached files below for answer.

5 0
3 years ago
Other questions:
  • Who knows about welding ??
    7·1 answer
  • Water at 20 bar and 400 C enters a turbine operating at steady state and exits at 1.5 bar. Stray heat transfer and kinetic and p
    14·1 answer
  • A pressure gage connected to a tank reads 50 psi at a location where the barometric reading is 29.1 inches Hg. Determine the abs
    6·1 answer
  • Technician A says that when using an impact wrench to remove a bolt from the front of an engine's crankshaft, the crankshaft mus
    15·1 answer
  • An ideal Diesel cycle has a compression ratio of 17 and a cutoff ratio of 1.3. Determine the maximum temperature of the air and
    10·1 answer
  • 3. Technician A says passive permanent
    5·1 answer
  • Suppose you have two arrays: Arr1 and Arr2. Arr1 will be sorted values. For each element v in Arr2, you need to write a pseudo c
    11·1 answer
  • A front wheel drive vehicle with four wheel disc brakes is pulling to the left. Tech A says an external kink or internal restric
    13·1 answer
  • I want to solve the question
    11·1 answer
  • Which of the following is not caused by alcohol?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!