Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Science. Java. We haven't learned Arrays/lists yet Starting 1. In Eclipse, create a new project or use an assignments one. Add a package a4,

Computer Science. Java.

We haven't learned Arrays/lists yet

image text in transcribed

Starting 1. In Eclipse, create a new project or use an assignments one. Add a package a4, and a class Search AndOptimizingLoops to that package. Copy and paste Picture.java and an image file from prior work into this package (Picture.java should update itself to the a4 package). 2. In your class, implement the static methods specified below. 3. All methods you write should have a Javadoc comment with a description of what the method does and a @param for each parameter and a @return describing what information is returned. 4. Add a main method with tests for each method. Your tests should cover possible return values (such as true or false) as well as special cases (for example, empty strings). Your tests should print what was tested, how it was tested, and the actual result from the method in a neatly formatted way. 5. You do not need to test for cases that are prohibited in the description. If the description says that there is at least X in the parameter, then you do not need to test for the truth of that constraint. 6. None of your methods except for main may print anything to the console. 7. Ensure you have consistent spacing and indenting in your file, proper and consistent indenting, and a Javadoc comment about the start of the class definition with your name, assignment number and class. Required Methods You must implement each of the described methods with method name, return type and parameters carefully checked against the specification. When parameters are specified you must use the order they are listed in. You may implement additional methods if they aid your problem-solving. 1. Method name:findSmallestPositiveNumber Parameter(s): A String containing integer numbers separated by spaces. There must be at least one positive number in the String. Return value: An int value that is the smallest number greater than 0 in the input string. Example: findSmallest PositiveNumber("2-45") should return 2. Note: Even though I put this first, I would consider working on this later. The other methods are basically just applying the patterns we looked at in class. This one is similar but requires a little more working out the logic of the problem. 2. Method name: lowestAlphabetically Parameter(s): A String of lower-case words separated by spaces and made up of the letters a-z. The String will have at least one word. Return value: A String containing the lowest alphabetical word. The String method compare To() does a lexicographic comparison between two strings, which allows you to test for the lowest alphabetical word. Read documentation on compareTo() in order to understand how to use it. Example: lowestAlphabetically("cat dog apple fish") would return "apple". 3. Method name: findSmallestNumberin TwoStrings Parameter(s): Two String parameters. Each string is made up of numbers separated by spaces. The first string must have at least one number. Return value: An int containing the smallest number found in the two strings. Example: findSmallestNumberin TwoStrings("123 5","2-1 10") would return -1

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

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

What are our strategic aims?

Answered: 1 week ago