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
At a festival, spherical balloons with a radius of 140.cm are to be inflated with hot air and released. The air at the festival
Tpy6a [65]

Answer:

find attached

Explanation:

5 0
3 years ago
Fuel filters are being replaced on a HPCR diesel
saw5 [17]

Answer:) The correct answer is B. at the end of the fuel rail.

2) The one who is correct is the Technician A.

Explanation:

7 0
3 years ago
The 1000-lb elevator is hoisted by the pulley system and motor M. The motor exerts a constant force of 500 lb on the cable. The
klemol [59]

The power that must be supplied to the motor is 136 hp

<u>Explanation:</u>

Given-

weight of the elevator, m = 1000 lb

Force on the table, F = 500 lb

Distance, s = 27 ft

Efficiency, ε = 0.65

Power  = ?

According to the equation of motion:

F = ma

3(500) - 1000 = \frac{1000}{32.2} * a

a = 16.1 ft/s²

We know,

v^2 - u^2 = 2a (S - So)\\\\v^2 - (0)^2 = 2 * 16.1 (27-0)\\\\v = 29.48m/s

To calculate the output power:

Pout = F. v

Pout = 3 (500) * 29.48

Pout = 44220 lb.ft/s

As efficiency is given and output power is known, we can calculate the input power.

ε = Pout / Pin

0.65 = 44220 / Pin

Pin = 68030.8 lb.ft/s

Pin = 68030.8 / 500 hp

     = 136 hp

Therefore, the power that must be supplied to the motor is 136 hp

5 0
4 years ago
Much of the workd went to bed hungry
Marysya12 [62]
The workers went to bed hungry probably because they are hard workers and so didn’t want to eat because they didn’t want to take break┌(; ̄◇ ̄)┘
7 0
3 years ago
A clutch is chattering. Technician A says that uneven wear on the flywheel could be the cause. Technician B says that worn or br
svet-max [94.6K]

Answer:

Both Technician A and B are correct

Explanation:

Due to a contamination of the clutch disc friction surface, the clutch chatters

The contamination that causes clutch chattering includes

1) Worn or broken motor mounts

2) Bell housing bolts becoming loose

3) Clutch link damage

4) Warped flywheel, due to overheating, the flywheel can become warped such that the non uniform surface interfaces the clutch resulting in clutch chattering

5) Engine or transmission oil contaminating the disc.

4 0
3 years ago
Other questions:
  • A water jet jump involves a jet cross-sectional area of 0.01 m2 , and a jet velocity of 30 m/s. The jet is surrounded by entrain
    6·1 answer
  • The following liquids are stored in a storage vessel at 1 atm and 25°C. The vessels are vented with air. Determine whether the e
    5·1 answer
  • In a typical transmission line, the current I is very small and the voltage V is very large. A unit length of the line has resis
    8·1 answer
  • You are a technical writer for Landson Toy Company. Landson has just designed a new, more durable swing set for 6- to 10-year-ol
    9·1 answer
  • Write what you already know about college majors. What are they? Can you think of any examples? When do you have to pick one? Ca
    10·2 answers
  • List a minimum of four reasons why you might be rejected for a job offer.
    10·1 answer
  • Construction lines are thick lines true false
    11·2 answers
  • What is the difference between class 1 and class 3 lever?
    8·2 answers
  • Q1-A Lossless transmission line is 80 cm long and operates at a frequency of 500 MHz. Two line parameters are L=0.15μH/m and C=9
    5·1 answer
  • At the beginning of last year, tarind corporation budgeted $1,000,000 of fixed manufacturing overhead and chose a denominator le
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!