Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that reads from this file (name it passage.txt) the following da

ID: 3641258 • Letter: W

Question

Write a program that reads from this file (name it passage.txt) the following data
and the program should determine how many words that starts with a vowel. The vowels are: a, e, i, o, u.:


Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low level facilities. Java applications are typically compiled to bytecode that can run on any Java Virtual Machine regardless of computer architecture. Java is a general purpose, concurrent, class-based, object-oriented language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers write once, run anywhere, meaning that code that runs on one platform does not need to be recompiled to run on another. Java is currently one of the most popular programming languages in use, particularly for client-server web applications, with a reported 10 million users





Explanation / Answer

import java.io.*; import java.util.Scanner; class Hangman { static String fFileName = "mypath/to/text.txt"; //place path to text file here public static void main(String[]args) throws IOException { int count=0; try { BufferedReader in = new BufferedReader(new FileReader(fFileName)); String str; while ((str = in.readLine()) != null) { if(str.startsWith("a")||str.startsWith("e")||str.startsWith("i")||str.startsWith("o")||str.startsWith("u")) { count++; } } in.close(); } catch (IOException e) { System.out.println("File not found"); } System.out.println("There are " + count + " words that start with a vowel"); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote