Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question # 1 First, you'll need to create a project. Steps you need to follow. step1. Start JGrasp. It may ask you if you want

Question # 1

First, you'll need to create a project.

Steps you need to follow.

step1. Start JGrasp. It may ask you if you want the default language to be Java, C, C++, Python. If it does, just choose Java.

Go to the File menu and select New -> Java

Notice that you have a choice of languages. Let's choose a Java project

Change the directory location to something "safe". You may want to temporarily choose the Desktop and then save the file to something permanent once you're done (e.g. flash drive).

You should now see an open file.

step2.Put your name as a comment on the top of the class.

Step3.Write the name of the class, perhaps Lab2ALinear

Step4.Write the main method header

step5.Add a new java class to your existing folder.

step6.Put your name as a comment on the top of the class.

step7.You will be generating random numbers so import java.util.Random.

step8.You should consider developing the methods for this project incrementally.

step9.In main, use an initializer list create an array of ints called nums holding the following values: 1, 4, 4, 22, -5, 10, 21, -47, 23

step10.Write a method, called linearSearch, that returns the index of the key element if found in the array, otherwise it will return a -1

step11.Create an int array of size 20, called data and write a method to fill the array with random ints [-100, 100]. Recall that randoms nextInt( x) method returns a value from 0 to x-1. The upper bound is exclusive. Modify the values to fit the required ranges.

step12.Use the linearSearch method you previously wrote to return the index of the key value searched for in data for the client to print

step13.Print the value of the key value search for and the index of the value, if found, or the phrase Value not found in the array, if not found.

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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

Define marketing.

Answered: 1 week ago

Question

What are the traditional marketing concepts? Explain.

Answered: 1 week ago

Question

Define Conventional Marketing.

Answered: 1 week ago

Question

Define Synchro Marketing.

Answered: 1 week ago