Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction This will be a relatively short assignment, with the purpose of reviewing some programming and java basics. It is expected that you have previously

Introduction This will be a relatively short assignment, with the purpose of reviewing some programming and java basics. It is expected that you have previously studied all of the topics necessary to complete this assignment. If you are unfamiliar with any of the concepts in this assignment, you must spend some time learning them. Later assignments will expect mastery of basic programming skills. Requirements Write a program from scratch. Create a single java file with a single main method, and another helper method. The main method should carry out the following steps: 1. Prompt the user to enter an integer 2. Read an integer value (given by the user) from System.in You may use java.util.Scanner or any other method that you know 3. Call the helper method passing this integer as a parameter 4. Ask the user if they want to enter another integer 5. Repeat the previous steps if yes, and end the program otherwise Your helper method should do the following: 1. Accept an integer value as a parameter 2. Create an array of chars with a size equal to the given integer 3. Use java.util.Random to assign a random lowercase alphabetical character at each index of the array Your code should be able to generate every possible lowercase alphabetical character Your code should not generate any characters that are not lowercase alphabetical characters 4. Find the smallest value in the array and swap it with the first value in the array 5. Create a String containing all the characters from your array, in the same order 6. Count the number of vowels 7. Append the count of vowels to the end of your string, separated by a single space 8. Print your string to the console 9. Print the length of the string to the console, using the format: Length of String: [XX] Concerning user input For this assignment you dont have to worry about validating user input. If the user does not give a valid integer value for the array size, its ok if the program crashes or does something unexpected. It should work for 0! Concerning style This program will be graded on correctness, but also on style. Make sure your code is readable. Make sure you use whitespace and indentation appropriately. Make sure your input and output are as clean and readable as possible.

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

Step: 3

blur-text-image

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

1. Explain how business strategy affects HR strategy.

Answered: 1 week ago