Java program to find a value at in index

Assignment Help JAVA Programming
Reference no: EM1379120

Construct a main class named Array Program that generates an array of 50-integers, all ranging from one to one hundred. The program should then prompt the user to enter an array index so the number in the array at that index can be found, but the user might not enter an integer. That would throw an Input Mismatch Exception. Take steps to scold the user and stop the program if this happens.

If the user does enter an integer, call a method named return Index Value to return the integer at the specified index in the array. This method will take the array and the desired index as arguments, but the index may be too big for the array. That would throw an Array Index Out Of Bounds Exception. Deal with that possible scenario in return Index Value.

The main method should print the integer at the specified index if no exceptions are thrown. Sample runs are shown below.

Run One
Enter index of array to display.
four
You must enter an integer for the index.
Program stopped.

Run Two

Enter index of array to display.
75
75 is too high.
Index must be 0-49.
Run Three
Enter index of array to display.
35
That index holds 26

Reference no: EM1379120

Questions Cloud

Construct java program named collegelist : Construct a set of classes for a college to use in many student service and personnel applications. Classes you require to design include following:
Elements from a html document : Function test Count List Elements should simply retrieve an array of all list elements on the page and assert that their total count is 3.
Fixing errors in a java program : You coded the following on line ten of the class MyApplet.java:
Sequence of method in vector class : Construct a Vector class implementing a number of vector operations as methods along with a testing program to verify the class is working.
Java program to find a value at in index : Construct a main class named Array Program that generates an array of 50-integers, all ranging from one to one hundred.
Discuss primary financial statements : Discuss primary financial statements published by a corporation, the various classifications used in a balance sheet-What is the purpose of a Balance Sheet? What information does it provide?
Java program for creating a order menu : Assume your consulting company has been hired to construct a program that meets the following requirements.
Market entry cultural report : Market Entry Cultural Report - the reasons for your country of choice and the market entry strategy you recommend
Intrinsic and instrumental values : Exactly what will it imply to express which some thing offers worth? Its a method of stating it offers really worth.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Java threads

This is an introductory assignment on Java synchronization. You will use Java Threads while learning more about concurrency and achieving atomicity using Java’s inbuilt mechanisms.

  Java application to generate three-digit random number

Write a Java application that generates a 3-digit random number 100 times. Display the output for each of the generated numbers and the sum of all 100 numbers.

  Compute the temperature in centigrade

Compute the temperature in Centigrade - Display the temperatures in both Centrigrade and Fahrenheit with appropriate labels, using the + operator to concatenate the labels with the variables

  Point of sale terminal

a software implementation of a Point of Sale terminal at a typical store. The users of the system are the cashiers sitting at the sales terminals of the store. The users can use the system to manage sales items in the store, customer details and of c..

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

  Mean and standard deviation using using eclipse

Java programming to calculate Mean and standard deviation using Using Eclipse.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Create web application uses visual web java server

Create the Web application which uses Visual Web Java Server Faces framework and either Apache Tomcat or Glassfish as the server.

  Compute area and perimeter of a polygon

Create a project that would let a user compute area and perimeter of a polygon

  Write a java program to register students for a college

Project is for designing and developing a College Registration program. Write a Java program to register students for a college

  Write applet which reads five numbers-draw equivalent stars

Write the applet which reads five numbers (each between 1 and 30). For each number read, your program must design line containing that number of adjacent asterisks.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd