Given an array of 10 names, complete the main method that outputs the name specified by the array index entered by the user. Use a try block to output the name and a catch block to catch any ArrayIndexOutOfBounds Exception. Output the message from the exception object if an ArrayIndexOutOfBounds Exception is caught. Output the first element in the array if the index is negative or the last element if the index is greater than the size of the array.
Q: Show how internal IT and network risk controls may be used to combat employee policy violations.
A: Introduction: IT security policies ought to constantly incorporate the reason, extension, policy,…
Q: ackerman steering priciple
A: Steering wheel seems like a basic part with a straightforward work - to turn the wheel in your ideal…
Q: What is the difference between Windows modes that shut down the machine and those that do not?
A: Given: A programme called Installer Windows Module is used to automatically check for updates to…
Q: ercise 1: (Design of algorithm to find greatest common divisor) In mathematics, the greatest common…
A: Step 1 Make an array to store common divisors of two integers m, n. Step 2 Check all the integers…
Q: What does overflow indicate for unsigned numbers?
A: unknown numbers: Positive numbers are those that are not signed. Numbers that are not signed do not…
Q: What are the definitions of database users and database administrator responsibilities? B) Compares…
A: Database users are given access to read, insert, update, and delete specific objects which define a…
Q: How does a system model differ from other kinds of models? Which components should be considered…
A: Definition: The system model is a process-oriented representation that highlights the impacts, or…
Q: NVL to replace null value
A: The NVL function lets you substitute a value when a null value is encountered. NVL is a substitute…
Q: Show that the fuzzy rule "If x is A OR y is B then z is C" is equivalent to the union of the two…
A: Let A be x is A, C be Z is C and B be y is B. The statement 'If y is B then z is C' can be written…
Q: What are the benefits and drawbacks of the worldwide cloud computing network?
A: Cloud computing is when entities share a network of remotely accessible servers. The servers are…
Q: Here error i can not detect. here i am retrieving xml data in html page in table form by Ajax…
A: In this question we have to write a code for HTML/AJAX and XML data to present on the table in HTML.…
Q: Provide an overview of the knowledge information system's numerous functions.
A: INTRODUCTION: Technically Speaking: Data collection, analysis, storage, and dissemination are the…
Q: Write the function of crossbar switch?
A: Switch bar: In the Crossbar Switch system, several crosspoints are maintained at junctions where the…
Q: 5. Will the given program go to the catch block even after the presence of the return statement in…
A: Given: A JAVA program having try-catch block is given and inside the try block an array is declared…
Q: How does an operating system (OS) function? What occurs when the operating system, software, and…
A: What an Operating System Is Used For (OS) A piece of software called an operating system manages…
Q: This section will examine how cloud environments host network services and applications.
A: Introduction: The hosting of network services and applications inside cloud environments must be…
Q: d. 01101111 11100011 OC TC e. 11101101 11110001
A: d. One's Complement: 01101111 + 00011100 ------------- 10001011 Now take the 1’s complement of…
Q: Why are binary and decimal numbering systems considered positional?
A: The binary number system is an positional numeral system used in mathematics. It uses the number 2…
Q: What is Perceptron? And how does it Work?
A: According to the information given: We have to define Perceptron & how does it Work.
Q: hello it doesnt seems to answer the question using hackerrank
A: We need to write a Python code for the given scenario.
Q: What is SWIFT? What role does it play in cross-border payments?
A: The Society for Worldwide Interbank Financial Telecommunication (SWIFT) is the primary secure…
Q: You are the director of information and technology for a business that routinely hires student…
A: Definition: The tools for operating distributed systems using computer systems on an enterprise-wide…
Q: To prevent modification anomalies, which of the following are created for a relation? Group of…
A: Correct answer is " 6 " " 6. Normal Forms " Remaining options explanation : - Functional…
Q: What are the definitions of database users and database administrator responsibilities? B) Compares…
A: Roles of: Database administrator: installing and upgrading the application tools and database…
Q: What are the pros and downsides of cloud computing on a global scale?
A: Introduction: With the use of this technology, businesses may provide their clients compute services…
Q: he fact that the value of a foreign key attribute must exist in another set of one or more key…
A: The answer is referential integrity constraint
Q: What is cloud scalability and how does it function? What characteristics make cloud computing so…
A: In this question we need to explain the concept of cloud scalability in cloud computing. We also…
Q: How to diagnose a mysterious process that’s taking too much CPU, memory, IO, etc?
A: to diagnose a mysterious process that’s taking too much CPU, memory, IO, etc:-
Q: I have a string and i want to do for loop to extract everything between "Open conversation" to "Open…
A: One of the ways to extract the strings between 'Open conversation' is to use the split function of…
Q: What are the four divisions of the TCSEC? Each division has to be stated.
A: The TCSEC has designated four divisions: D, C, B, and A, with division A having the most…
Q: Perform the following binary multiplications using Booth's algorithm, assuming signed two's…
A: The solutions are given below with step by step calculation Happy to help you ?
Q: Big data is a word used to describe voluminous amounts of data. What business challenges does big…
A: Given: First, what is big data? 2. Describe the difficulties that big data presents to the…
Q: Using the Master database in MS SQL Server, compose a SQL query to create the Nam Team database,…
A: A database with the specified name is created using CREATE DATABASE. You must have the database's…
Q: plain in your own words the Cyclic Redundancy Check method for Error Detection. Give an example of…
A: Introduction: A cyclic redundancy check (CRC) is an error-detection code that is extensively used in…
Q: Explain the differences between loT and M2M using a Health Band as an example. Compare the major…
A: The use of the Internet of Things - (IoT) in healthcare, including commerce, disclosure of personal…
Q: What input must be provided to the following “ for Loop With Sum” fragment for it to display 20?…
A: C++ Program: #include <iostream> using namespace std; int main() { int n, sum =…
Q: (1) Draw an ER Diagram for the scenario below Temporary Employment Corporation (TEC) places…
A: There are a total of 6 entities. Entities are: opening folder, qualification, placement folder, job…
Q: NVL to replace null value.
A: NVL: The NVL() function allows to replace null value with meaningful alternative in the results of…
Q: What exactly does "virtual conferences" mean?
A: The solution to the given question is: A virtual conferences is a meeting that takes place online ,…
Q: Describe the most vital characteristics of the information. How do they contribute to the study of…
A: Internet safety: Computer security is the promise of defense against attacks for the computer…
Q: Can you conceive of a method to improve the functionality of a filing cabinet?
A: Introduction: Businesses produce and send forth a sizable amount of electronic data every day. Is…
Q: If required, define the following terms using the proper syntax. Additionally, clarify the use of…
A: There are several questions posed, and we are only going to answer the first three of them. If you…
Q: [2] ( Explain for each line why you chose a certain suffix such as b,w,l or q For each of the…
A:
Q: What are the positives and downsides of cloud connection on a global scale?
A: Global cloud connectivity: The two first forms of digital communication are bulletin boards and…
Q: What distinct technologies enable users to transmit vast volumes of data via the Internet?
A: Introduction: A network is an association between at least two computers that are utilized to share…
Q: Talk about the value of project scheduling and the challenges it presents. Talk about describe, and…
A: Definition and Description: Project Scheduling is the most critical component of project planning,…
Q: What is a necessary to latch with output devices such as LED's? transparent latch? Why is it
A:
Q: C++ DOUBLY LINKED LIST: Implement the remove_between function for my code: This function removes…
A: Given: Write and Implement the remove_between function in C++ which will removes the inserted/ added…
Q: c code Screenshot and output is must
A: The answer is given below. Algorithm: Start. Prompt user to input the string. Prompt user to enter…
Q: Is it accurate that associative entities are also regarded as weak entities? What justification or…
A: Associated thing: • One or more instances of an entity type are linked together by an associative…
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
String[] names = { "Ryley", "Edan", "Reagan", "Henry", "Caius", "Jane", "Guto", "Sonya", "Tyrese", "Johnny" };
int index;
index = scnr.nextInt();
/* Type your code here. */
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- 7.35 LAB: Exception handling to detect input String vs. Integer The given program reads a list of single-word first names and ages (ending with -1), and outputs that list with the age incremented. The program fails and throws an exception if the second input on a line is a String rather than an Integer. At FIXME in the code, add a try/catch statement to catch java.util.InputMismatchException, and output 0 for the age. Ex: If the input is: Lee 18 Lua 21 Mary Beth 19 Stu 33 -1 then the output is: Lee 19 Lua 22 Mary 0 Stu 344.10 LAB: Exception handling to detect input string vs. integer The given program reads a list of single-word first names and ages (ending with -1), and outputs that list with the age incremented. The program fails and throws an exception if the second input on a line is a string rather than an integer. At FIXME in the code, add try and except blocks to catch the ValueError exception and output 0 for the age. Ex: If the input is: Lee 18 Lua 21 Mary Beth 19 Stu 33 -1 then the output is: Lee 19 Lua 22 Mary 0 Stu 34 # Split input into 2 parts: name and ageparts = input().split()name = parts[0]while name != '-1': try: age = int(parts[1]) + 1 except: age - 1 print('{} {}'.format(name, age)) parts = input().split() name = parts[0] Traceback Total score: 0 / 10 Only show failing tests Download this submission 1: Compare outputkeyboard_arrow_up 0 / 1 Output differs. See highlights below. Input Lee 18 Lua 21 Mary Beth 19 Stu 33 -1 Your…1-Write a JAVA program that reads an array from input file and invokes twodifferent methods Sort and Max ,that sorts the elements of the array and findsthe Max element and writes out the resulted array in to output file . Usetwo interfaces for methods and throw Exception Handling for Out Of Boundindex for the array
- PYTHON: Given a main program that searches for the ID or the name of a student from a dictionary, complete the find_ID() and the find_name() functions that return the corresponding information of a student. Then, insert a try/except statement in main() to catch any exceptions thrown by find_ID() or find_name(), and output the exception message. Each entry of the dictionary contains the name (key) and the ID (value) of a student. Function find_ID() takes two parameters, a student's name and a dictionary. Function find_ID() returns the ID associated with the student's name if the name is in the dictionary. Otherwise, the function throws a custom exception type, StudentInfoError, with the message "Student ID not found for studentName", where studentName is the name of the student. Function find_name() takes two parameters, a student's ID and a dictionary. Function find_name() returns the name associated with the student's ID if the ID is in the dictionary. Otherwise, the function throws a…Complete a program that reads a vector index as input and outputs the element of a vector of 10 names at the index specified by the input. Use a try block to output the name and a catch block to catch any out_of_range exceptions. When an out_of_range exception is caught, output the message from the exception object and the first element in the vector if the index is negative or the last element if the index is greater than the size of the vector. Hint: Format the exception outputs using the what() function from the exception object. Do not hard code the exception messages. Ex: If the input of the program is: 5 the program outputs: Jane Ex: If the input of the program is: 12 the program outputs: Exception! vector::_M_range_check: __n (which is 12) >= this->size() (which is 10) The closest name is: Johnny Ex: If the input of the program is: -2 the program outputs: Exception! vector::_M_range_check: __n (which is 18446744073709551614) >= this->size() (which is 10) The closest…Type up the code, execute and submit the results ONLY. 1. Enter a valid array index2. Enter an invalid array index3. Enter a letter instead of an integer – NOTE: Using the general error will show you the type of exception was caught, and you can then update your code to catch that type of error.4. Try putting the “Exception e” before the IndexOutOfBoundsException eob what happens and are you able to run the code – what happens?
- The given program reads a list of single-word first names and ages (ending with -1), and outputs that list with the age incremented. The program fails and throws an exception if the second input on a line is a string rather than an integer. At FIXME in the code, add try and except blocks to catch the ValueError exception and output 0 for the age. Ex: If the input is: Lee 18 Lua 21 Mary Beth 19 Stu 33 -1 then the output is: Lee 19 Lua 22 Mary 0 Stu 34 code name = ()age = ()parts = input().split()name = parts[0]while name != '-1':# FIXME: The following line will throw ValueError exception.# Insert try/except blocks to catch the exception.age = int(parts[1]) + 1print('{} {}'.format(name, age))# Get next lineparts = input().split()name = parts[0]9.5.1: Use the addChoice method to add any needed instance variables. Provide a different implementation of ChoiceQuestion. Instead of storing the choices in an array list, the addChoice method should add the choice to the question text. For this purpose, an addLine method has been added to the Question class. ChoiceQuestion.java: /** A question with multiple choices.*/public class ChoiceQuestion extends Question{ // Add any needed instance variables, but don't store the choices // The choices should be added to the text of the superclass /* Your code goes here */ /** Constructs a choice question with a given text and no choices. @param questionText the text of this question */ public ChoiceQuestion(String questionText) { /* Your code goes here */ } /** Adds an answer choice to this question. @param choice the choice to add @param correct true if this is the correct choice, false otherwise */ public void…4.4.1: Modify an array parameter. Write a method swapArrayEnds() that swaps the first and last elements of its array parameter. Ex: sortArray = {10, 20, 30, 40} becomes {40, 20, 30, 10}.
- Task 3 1.To write a java program, with a class named Multiply and add main() within the class. The Multiply class is going to multiply two numbers together that are input by using the command-line arguments. 2. Within main(), declare a try block that parses the first two command-line arguments into ints by using the Integerparse Int() method. 3. Your try block is going to have two catch blocks, one for an Array-IndexOutOfBoundsException and one for a Number Format Exception. 4. If an Array Index Out Of Bounds Exception occurs, the user has not input two command-line arguments. Inform the user of this, print the stack trace, and have main() end using a return statement. 5. If a Number Format Exception occurs, the user has input invalid command-line arguments. Inform the user that the program expects two ints; then print the stack trace and have main() end. 6. If no exception occurs, print out the two ints and also their product. 7. Save, compile, and run the Multiply program several…Given a main program that searches for the ID or the name of a student from a dictionary, complete the find_ID() and the find_name() functions that return the corresponding information of a student. Then, insert a try/except statement in main() to catch any exceptions thrown by find_ID() or find_name(), and output the exception message. Each entry of the dictionary contains the name (key) and the ID (value) of a student. Function find_ID() takes two parameters, a student's name and a dictionary. Function find_ID() returns the ID associated with the student's name if the name is in the dictionary. Otherwise, the function throws a custom exception type, StudentInfoError, with the message "Student ID not found for studentName", where studentName is the name of the student. Function find_name() takes two parameters, a student's ID and a dictionary. Function find_name() returns the name associated with the student's ID if the ID is in the dictionary. Otherwise, the function throws a custom…Given a main program that searches for the ID or the name of a student from a dictionary, complete the find_ID() and the find_name() functions that return the corresponding information of a student. Then, insert a try/except statement in main() to catch any exceptions thrown by find_ID() or find_name(), and output the exception message. Each entry of the dictionary contains the name (key) and the ID (value) of a student. Function find_ID() takes two parameters, a student's name and a dictionary. Function find_ID() returns the ID associated with the student's name if the name is in the dictionary. Otherwise, the function throws a custom exception type, StudentInfoError, with the message "Student ID not found for studentName", where studentName is the name of the student. Function find_name() takes two parameters, a student's ID and a dictionary. Function find_name() returns the name associated with the student's ID if the ID is in the dictionary. Otherwise, the function throws a custom…