
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
![d) Identify THREE (3) error for the code below ( name Types of the error and write the
line with error ) and rewrite the code with error free code.
public class ErrorTry {
public static void main (String [] args) {
double [] MyArray = {1.9, 2.9, 3.4, 3.5};
w n men
for (int i
System.outprintln (MyArray li] + " ");
= 0; i < MyArray.length; i++) {
}
double total = 0;
for (int i < 0; i < MyArray.length; i++) {
total += MyArray [i];
}
System.out println ("Total is " + total);
double max
= MyArray [4];
= 1;
< MyArray. length; i++) {
for (int i
if (MyArray li] > max) max = MyArray [i];
wom
}
System.out.println ("Max is
+ Max) ;
}
}](https://content.bartleby.com/qna-images/question/aed2203a-c7c4-48db-9b55-4c3ba90e4885/7204988b-3d50-48ef-a06c-daa27dc17b31/wh8mnja_thumbnail.png)
Transcribed Image Text:d) Identify THREE (3) error for the code below ( name Types of the error and write the
line with error ) and rewrite the code with error free code.
public class ErrorTry {
public static void main (String [] args) {
double [] MyArray = {1.9, 2.9, 3.4, 3.5};
w n men
for (int i
System.outprintln (MyArray li] + " ");
= 0; i < MyArray.length; i++) {
}
double total = 0;
for (int i < 0; i < MyArray.length; i++) {
total += MyArray [i];
}
System.out println ("Total is " + total);
double max
= MyArray [4];
= 1;
< MyArray. length; i++) {
for (int i
if (MyArray li] > max) max = MyArray [i];
wom
}
System.out.println ("Max is
+ Max) ;
}
}
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Q1 Which of the following statements is true if x (a character array) is added (+) to a y (2 x 2 double)? Select one: a. Variable x will be converted into a double and then concatenated with y to create new ASCII-type variable b. The addition operation (+) cannot be performed c. Variable y will be converted into a string and then concatenated with x to create a new string-type variable d. ASCII values of x are added to y to create a new double-type variable e. It is equivalent to the statement x == y and creates a logical-type variable Q2 Consider the following non-linear equation where x is the independent variable, y is the dependent variable, and A and B are constants. Which of the following is the resulting gradient variable in linearised form? Select one: a. B b. log10(B) c. log(-A) d. A e. exp(B) Q3 Which of the following statements is false for the function header below? function [cat, ox, dragon] = rat(pig, snake) Select one:…arrow_forwardNEED HELP WITH PYTHON CODE. ALSO, PLEASE PROVIDE DETAILS SEPARATELY ON HOW AND WHAT DID U USE TO GET UR CODE DONE.arrow_forwardAnswer in R code pleasearrow_forward
- With the aid of c++, write a code which utitilizes a random number generator to generate a 2 digits +(positive) integer. The user is permitted to do the operations listed below using the above knowledge.i.Reverse the digits of the randomly generated number ii.Double the randomly generated number iii.Add up(sum) the digits of the randomly generated number iv.Also check if the randomly generated number is a prime after each operation.Note the following below In case the randomly generated number is less than 10 after performing the above operation add 10 to the itarrow_forwardi want copy of this codearrow_forwardn this assignment, we will learn a few fundamentals of Data Science. You will read some data values and display some basic statistics of the data set. Your program should: Prompt the user to enter an integer number. Validate the user input to make sure it is an integer. If not, ask the user to enter a valid integer only. You may use the str.isdigit(dataValue) function to check whether the user is entering only digits where dataValue is the user input, and the expression returns True if the entered characters were numbers. Add your integer into a list. Ask the user whether they want to add more data. When the user finishes entering data values, display the count, minimum, maximum, range, and average of your data set. To get the range of the data values, you should subtract the minimum value from its maximum. You can calculate count and average using the appropriate built-in functions.arrow_forward
- Part A, B pleasearrow_forwardIn [ ]: Exercise 1b Write code to calculate and print the quantities from the data sheet. For the momenta pli and p2i, the code is given. For the other quantities, uncomment the respective code lines and add your own code. You must use the given variable names; do not change their case (e.g. from Kli to kli). For full credit: • Use "f-strings" to print your calculated values. • Make sure each quantity is printed with its correct unit. Follow the example for pli. Verify that your code produces sensible results. pli m1*vli p2i = m2*v2i print (f'Momentum of m1 before collision: print (f'Momentum of m2 before collision: #pi #mtot = # pf #p_ratio= #print() #print () #print() #print () = = # Kli = # K2i = #print() # print () #Ki = # Kf = # K ratio = #print () #print() #print () # Momentum of m1 before collision #Momentum of m2 before collision #YOUR CODE HERE raise NotImplementedError() {pli:eP} kg•m/s') {p2i: eP} kg•m/s') # Total momentum before collision # Combined mass #Total momentum…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education