Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This problem set will test your knowledge of System I/O, variable assignment, flow control, and loops. Your task is to create several different java classes

This problem set will test your knowledge of System I/O, variable assignment, flow control, and loops. Your task is to create several different java classes (.java files) that will produce a specific output based on the user input. All input will be given to you either as a command-line argument or typed in from the keyboard.

Below you will find directions for each class you need to create. Please make sure that the class name and java file name match the name specified in the directions below. For example, the code for the problem named "ReverseInput" should be put in a java file name ReverseInput.java and that file should have a class named public class ReverseInput.

Once you have completed writing your code please compress the files into a zip and upload your code to Grader Than. Grader Than will not grade your submission unless all of the necessary files are included in the submission. In the event that you have completed some of the problems but not all, you can make a partial submission, by making an empty class file for the problems you have not completed. An empty class file just has the public class {...}Block within it nothing else. By doing this, Grader then will grade the files that have code and mark you off for the files that are missing code rather than not grading you completely.

ReverseInput

This application accepts user input from the console and then prints the reverse of the user input to the console. The last string that this program should print is the reverse user input.

WaitForCorrectWord

This application will be passed a single word in its command-line argument array. It will expect the user to type in this word. Then it should wait for the user to type the word in. If the user types in a word that does not match the word it was initially given, the application should print a single line message saying "the input was incorrect" and then wait for the user to try again. The application should repeat this process an indefinite amount of times until the user types the correct value. When the user types in the correct word the application should print "the input was correct" then quit.

PrintMathResult

Write an application that will wait for three user inputted values in the following order:

a string operation which will be one of the following ('+', '-', '*', '/')

an integer

an integer

Once the user inputs the three values, it is supposed to perform the given operation (The first inputted value) on the numeric values (The second and third inputted values) and print the result to the console. This application should not print any other text to the console other than the result of the mathematical operation. The last string that this program should print is the result of the mathematical calculation.

SumRange

This script will be given a runtime argument of 3 values within it. The first user value will always be less than the second value. This script should calculate the sum of every nth whole number between the first and second value. The term "nth" denotes the step size which will be equal to the 3rd value. Example if the third value is 2 then it will add every other or every second value. If the third value is 4 it will add every 4th value. In the end the application should print the sum of the numbers to the console. The last string that this program should print is the result of the summation of the numbers.

Example: args: ["5", "9", "2"] output: 21 => 5+7+9

SplitString

This application accepts an arbitrary number of user inputs. Every time this application receives a string, it should add the string to a growing string. Newly added strings should be added to the growing string at the index equal to the newly added string's length. If the newly added string's length is equal to or larger than the growing string, this script should add the new string to the end of the growing string. When this application receives a blank input, this application should stop receiving input and print the growing string to the console. The last string that this program should print is the result of the growing string.

Example: input: 'hello' -> growing string: 'hello' input: 'bear' -> growing string: 'hellbearo' input: 'cow' -> growing string: 'helcowlbearo' input: 'disestablishment' -> growing string: 'helcowlbearodisestablishment' input: '' -> growing string: 'helcowlbearodisestablishment'

output: 'helcowlbearodisestablishment'

AllEvenOdd

Your application will be given an arbitrary number of strings that are numbers in its runtime arguments. The application will count the total number of odd and even numbers in the runtime arguments. If the total number of runtime arguments is even then it will count only even numbers, if the total number is odd it will count only odd numbers. The total number of runtime arguments is also the length of the runtime argument string array. It will print the total number of even or odd numbers to the console. The last string that this program should print is the result of the total number of odd or even numbers. Example: Runtime Argument: [6, 5, 1, 6, 9, 2, 3] Output: 4 Runtime Argument: [9, 1, 5, 1] Output: 0

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

More Books

Students also viewed these Databases questions

Question

Describe the importance of employer branding.

Answered: 1 week ago

Question

Explain corporate sustainability.

Answered: 1 week ago