Class arrayprogram that generates an array of fifty integers

Assignment Help C/C++ Programming
Reference no: EM13939921

Write a main class named ArrayProgram that generates an array of fifty integers, all ranging from 1 to 100. 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 InputMismatchException. Take steps to scold the user and stop the program if this happens.

If the user does enter an integer, call a method named returnIndexValue 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 ArrayIndexOutOfBoundsException. Deal with that possible scenario in returnIndexValue.

The main method should print the integer at the specified index if no exceptionsare 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: EM13939921

Questions Cloud

Define the term radiopharmaceutical : Question A: Define the term Radiopharmaceutical. Question B: Describe the production of two different radioisotopes for medical imaging purposes.
Net income available to common stockholder plus depreciation : Assume NEWC has an investment opportunity (similar to the air bag opportunity in Other People's Money).The firm can spend $325 Million on refurbishing its wire and cable plant to develop a product that will be sold in packets or units of twenty. Assu..
Joint products a and b are produced in a single operation : Joint products A and B are produced in a single operation from Material M. 500 gallons of Material M, costing $550, produced 333 gallons of Product A, selling for $3 per gallon, and 167 gallons of Product B, selling for $7 per gallon.
Report for an educational organization on the development : Write a report for an educational organization on the development of a high quality and sustainable e-Learning environment. In the report you should: Identify your vision for e-Learning within the educational institution; briefly explain how this ..
Class arrayprogram that generates an array of fifty integers : If the user does enter an integer, call a method named returnIndexValue to return the integer at the specified index in the array
Consulting firm hired to develop a program : Your program must provide a menu to the user. This menu should list five different products of your choice. Once the user selects one product, they should specify which state they are located. The state choices should include CT, VT, WI, CA and WA..
Roles of resiliency and reactionary planning : Compare and contrast the roles of resiliency and reactionary planning in a counterterrorism strategy. Provide at least two examples of each type of planning
Magnetic resonance imaging : Magnetic Resonance Imaging is one of most important imaging technique, however, it still needs a lot of improvement to enhance the quality of the image and reduce time. In this report, the issue that has been focus on is who to reduce time of reco..
Whether economic indicators such as gdp : Write an economics dissertation on the topic of 'whether economic indicators such as GDP, inflation etc have a significant effect on General Election Outcomes in the Uk.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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