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

  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

  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.

  What position along the chord does minimum pressure occur

At what position along the chord does the minimum pressure occur? What is special about the point where C p is a maximum?

  Write java programming to show number of credits for course

Write the java programming to solve following problem. We are given a student's marks in Calculus 1, CS1, and Physics 1 (each mark being between 0 and 100) also number of credits for each course.

  Enterprise java beans (ejb) in software development

Enterprise Java Beans (EJB) in software development, EJB technology, EJB application, Stateless Session Beans (SLSB), Stateful Session Beans (SFSB), Message Driven Bean (MDB), Entity Bean

  Design an abstract data type in java

Design an abstract data type in Java that represents a musical pitch

  Distributed systems

Build robust, secure distributed systems using advanced programming techniques

  A jsp expression can contain any java expression

A JSP expression can contain any Java expression that evaluates to a

  World data app

Prepare WorldDataApp project. It implements the NameIndex portion, including creating it in SetupProgram, and searching, viewing and updating it in UserApp program.

  Create a driver class in java

Your project is to create a driver class that uses SuperJavaIceCreamClass.

  The objective is to implement a menu-based system

The objective is to implement a menu-based system for Bank Accounts in order to simulate a very simple banking system. Many structures have to be declared to manage bank accounts.

  Implement the finite field gf

Write a program called "GF2.java" to implement the finite field GF(p n )where p is a prime number andn is a positive integer.You also need to write four methodsto realize.

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