Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

tedx.txt - https://drive.google.com/file/d/1ByaMdehssDQqLsNki8Io9B42_iS_LhXe/view?usp=sharing Java Instructions Write a program that does the following: Part 1 of 2 - Demonstrate using a for loop, a switch and

image text in transcribedimage text in transcribed

tedx.txt - https://drive.google.com/file/d/1ByaMdehssDQqLsNki8Io9B42_iS_LhXe/view?usp=sharing

Java

Instructions Write a program that does the following: Part 1 of 2 - Demonstrate using a for loop, a switch and using iterator to read from a txt file 1) Open the file provided to you on Moodle called tedx.txt. This file contains text. 2) Loop through the file with a while loop until its empty a) read in a line b) Loop through the line with a for loop to look at one character at a time i) Hint: we covered this in class last week with charAt() method ii) Use a switch statement with the character to count two quantities representing: (1) how many a, e, i, o, and u, in both upper and lower case, letters there are (2) how many other characters there are 3) Close the file after you input everything 4) When you have read all the lines in the file a) Output the quantity of vowels there are (upper and lower case as shown above) b) Output the quantity of other characters are c) Output each number as a percent of the overall count of characters, formatted 1 significant digit d) Example output on 2nd page File contents is from a TEDXTUBerlin transcript of a talk by Ben Tristem , called Navigating your learning journey. https://www.youtube.com/watch?v=aklWUpJB1uQ Part 2 of 2 - Demonstrate using a for each loop with an ArrayList 5) Fill an ArrayList with 10 random Integer numbers in the range (50,100] 6) Use a for each loop to output them and sum them 7) Output the sum when you exit the for each loop a) Example output on 2nd page Lab 6 Output Part 1 The number vowels letters are: 3625 The number of other characters are: 7515 The % of vowels is: 32.5% and the % of other characters is: 67.5% Part 2 62 66 80 89 73 96 51 75 75 62 Sum is 729

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

Describe the typical steps in the selection process.

Answered: 1 week ago