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]
4 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]4 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
9. A vehicle is having routine maintenance performed.
dexar [7]

Answer: b

Explanation:

8 0
3 years ago
What type of treatment is Dr. Wayne experimenting on?
shepuryov [24]

Answer:

Vaccine

Explanation:

4 0
3 years ago
This is used to keep all cleaning supplies and chemicals safe
bulgar [2K]
A storage room




common sense lol
6 0
3 years ago
For the following production environments, indicate whether the preferred production system is more likely to be a job shop (pro
Nina [5.8K]

Answer:

A) Batch shop production

B) Batch shop production

C) Job shop production

D) production line

Explanation:

A)The preferred production system here will be  Batch shop production because the manufacturer produces different styles of clothing and sells to small specialty stores hence producing in Batches can help meet up the needs

B) The preferred production system here will be Batch shop production because the manufacturer produces Gaskets and they are of different styles hence he needs to produce them in batches

C) Job shop production

D) production here is streamlined to a particular ( tablet form ) hence the production system here would be a Production line system of production

3 0
3 years ago
9. To forward bias an NPN transistor, the
murzikaleks [220]

Answer:

a. the base must be more positive than the emitter

Explanation:

A transistor can be defined as a semiconductor component that is used to control the flow of voltage or current and as a gate (switch) for electronic signals. Thus, a transistor allows for the amplification, control and generation of electronic signals in a circuit. The three (3) basic parts of a transistor are; base, emitter and collector.

Basically, there are two (2) main types of transistor and these are;

1. PNP transistor.

2. NPN transistor.

Biasing of a transistor can be defined as the process of providing the controlled amount of direct current (DC) voltage or current conditions so as to enable the transistor amplify the alternating current (AC) input signal correctly.

Hence, to forward bias an NPN transistor, the base must be more positive than the emitter because the majority carriers are electrons which are moved from the n-type region to the p-type region while the minority carriers are holes.

This ultimately implies that, for an NPN transistor to conduct current in milliamps, its base-emitter junction must be forward biased.

4 0
3 years ago
Other questions:
  • A person puts a few apples into the freezer at -15oC to cool them quickly for guests who are about to arrive. Initially, the app
    15·1 answer
  • A westbound section of freeway currently has three 12-ft wide lanes, a 6-ft right shoulder, and no ramps within 3 miles upstream
    12·1 answer
  • Consider airflow over a plate surface maintained at a temperature of 220°C. The temperature profile of the airflow is given as f
    6·1 answer
  • What is the minimum amplitude at time zero sine wave??
    13·1 answer
  • 23 PM Sat Apr 10
    7·1 answer
  • Which of the following best reflects a shield system?
    6·1 answer
  • ITS A TESTS PLSSS I NEED THIS RN
    6·1 answer
  • Start by setting aside money in your savings account for your goals and for emergencies. Then, fill in the other categories with
    10·1 answer
  • 15- Vipsana's Gyros House sells gyros. The cost of ingredients (pita, meat, spices, etc.) to make a gyro is $2.00. Vipsana pays
    10·1 answer
  • what is a home that has its own roof, foundation, and a wall that extends from the roof through the foundation
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!