
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
WHAT IS WRONG WITH THE CODE??? HOW DO YOU SOLVE THESES ERRORS???
![Online Java Compiler
0
To use dictation, go to Settings and turn on online speech recognition
с
programiz.com/java-programming/online-compiler/
Programiz Java Online Compiler
Learn Java App
Main.java
&
Run
Output
Clear
1- import java.util.Scanner;
♠ javac /tmp/ES4onxIySG/Main.java
2 import java.util. Random; // corrected: // removed
/tmp/ES4onxIySG/Main.java:19: error: incompatible types: int[][] cannot be converted to int[]
3
int[] dicePairSums = addDicePairs(dicePairs); //corrected: int[][] dicePairSums to int[] dicePairSums
^
4
5 public class Main {
/tmp/ES4onxIySG/Main.java:20: error: cannot find symbol
6
printDicePairsSum(dicePairs); // name of function is incorrect so changed.
7
public static void main(String[] args) { //corrected: string() to string[]
8
symbol: method printDicePairsSum(int[][])
9
Scanner input = new Scanner(System.in);
location: class Main
10
/tmp/ES4onxIySG/Main.java:59: error: incompatible types: int[] cannot be converted to int[][]
return pairSums;
11
System.out.println("Enter a amount of times a pair of dice will roll: ");
12
int times-input.nextInt (); // corrected: keyboard to input
13
3 errors
14
15
int[][] dicePairs = rollDicePairs (times); // corrected: int[] dicePairs to int[][] dicePairs
System.out.println("The rolled pairs of numbers are: ");
printDicePairs(dicePairs);
16
17
18
System.out.println("The sum of each pairs of numbers are: ");
19
int[] dicePairSums = addDicePairs(dicePairs); //corrected: int[][] dicePairSums to int[]
dicePairSums
20
printDicePairsSum(dicePairs); // name of function is incorrect so changed
21
22
}
23
24
//dicePairsSums -> dicepairSums
25
26
// name was given incorrectly
27
28
29
30
public static int[][] rollDicePairs(int times) { //public static double [] [] to public static int[][]
int[][] dice=new int[times] [2];
31
32
Random die=new Random();
33 ▾
for (int x=0; x<times; x++) {
34 ▾
for(int y=0; y<2; y++) {
35
dice[x][y] =1+die.nextInt (6);
36
HH
W
10
29°C Mostly clear
Type here to search
0;
x
ENG
9:54 pm
24/05/2022
:
1](https://content.bartleby.com/qna-images/question/97ca4758-a134-4ba5-a07a-389040228297/4441c763-e083-4fba-982e-7d476e845186/os0m4kg_thumbnail.png)
Transcribed Image Text:Online Java Compiler
0
To use dictation, go to Settings and turn on online speech recognition
с
programiz.com/java-programming/online-compiler/
Programiz Java Online Compiler
Learn Java App
Main.java
&
Run
Output
Clear
1- import java.util.Scanner;
♠ javac /tmp/ES4onxIySG/Main.java
2 import java.util. Random; // corrected: // removed
/tmp/ES4onxIySG/Main.java:19: error: incompatible types: int[][] cannot be converted to int[]
3
int[] dicePairSums = addDicePairs(dicePairs); //corrected: int[][] dicePairSums to int[] dicePairSums
^
4
5 public class Main {
/tmp/ES4onxIySG/Main.java:20: error: cannot find symbol
6
printDicePairsSum(dicePairs); // name of function is incorrect so changed.
7
public static void main(String[] args) { //corrected: string() to string[]
8
symbol: method printDicePairsSum(int[][])
9
Scanner input = new Scanner(System.in);
location: class Main
10
/tmp/ES4onxIySG/Main.java:59: error: incompatible types: int[] cannot be converted to int[][]
return pairSums;
11
System.out.println("Enter a amount of times a pair of dice will roll: ");
12
int times-input.nextInt (); // corrected: keyboard to input
13
3 errors
14
15
int[][] dicePairs = rollDicePairs (times); // corrected: int[] dicePairs to int[][] dicePairs
System.out.println("The rolled pairs of numbers are: ");
printDicePairs(dicePairs);
16
17
18
System.out.println("The sum of each pairs of numbers are: ");
19
int[] dicePairSums = addDicePairs(dicePairs); //corrected: int[][] dicePairSums to int[]
dicePairSums
20
printDicePairsSum(dicePairs); // name of function is incorrect so changed
21
22
}
23
24
//dicePairsSums -> dicepairSums
25
26
// name was given incorrectly
27
28
29
30
public static int[][] rollDicePairs(int times) { //public static double [] [] to public static int[][]
int[][] dice=new int[times] [2];
31
32
Random die=new Random();
33 ▾
for (int x=0; x<times; x++) {
34 ▾
for(int y=0; y<2; y++) {
35
dice[x][y] =1+die.nextInt (6);
36
HH
W
10
29°C Mostly clear
Type here to search
0;
x
ENG
9:54 pm
24/05/2022
:
1
![Online Java Compiler
с
programiz.com/java-programming/online-compiler/
Programiz Java Online Compiler
Main.java
33 ▾
for (int x=0; x<times; x++) {
34-
for (int y=0; y<2; y++) {
35
dice[x][y] =1+die.nextInt (6);
36
}
37
}
38
return dice;
39
}
40
41-
public static void printDicePairs (int[][] dicePairs){
42-
for (int[] pair: dicePairs) {
43-
for (int roll: pair) {
44
System.out.println(roll+" ");
45
}
46
System.out.println("");
47
}
48
}
49
50
public static int[][] addDicePairs(int [][] dicePairs){ // corrected: addDicePairs() to addDicePairs
(int[][] dicePairs)
51
int[] pairSums=new int[dicePairs.length];
52-
for (int x=0; x<pair Sums.length; x++) {
53
int sum=0;
54-
for(int y=0; y<dicePairs [x].length; y++) {
55
sum+=dicePairs [x][y];
56
}
57
pairSums [x]=sum;
58
}
59
return pairSums;
60
}
61
62-
public static void printDicePairs Sums (int[] dicePairSums) { //public static String to public static
void
63 -
for (int sum: dicePairSums) {
64
System.out.println(sum+" ");
65
}
66
67 }
W
10
}
Type here to search
O
0;
x
0
To use dictation, go to Settings and turn on online speech recognition
Learn Java App
G
Run
Output
Clear
• javac /tmp/ES4onxIySG/Main.java
/tmp/ES4onxIySG/Main.java:19: error: incompatible types: int[][] cannot be converted to int[]
int[] dicePairSums = addDicePairs(dicePairs); //corrected: int[][] dicePairSums to int[] dicePairSums
A
/tmp/ES4onxIySG/Main.java:20: error: cannot find symbol
printDicePairsSum(dicePairs); // name of function is incorrect so changed.
^
symbol: method printDicePairsSum(int[][])
location: class Main
/tmp/ES4onxIySG/Main.java:59: error: incompatible types: int[] cannot be converted to int[][]
return pairSums;
3 errors
29°C Mostly clear
ENG
9:54 pm
24/05/2022
:
1](https://content.bartleby.com/qna-images/question/97ca4758-a134-4ba5-a07a-389040228297/4441c763-e083-4fba-982e-7d476e845186/sre08ov_thumbnail.png)
Transcribed Image Text:Online Java Compiler
с
programiz.com/java-programming/online-compiler/
Programiz Java Online Compiler
Main.java
33 ▾
for (int x=0; x<times; x++) {
34-
for (int y=0; y<2; y++) {
35
dice[x][y] =1+die.nextInt (6);
36
}
37
}
38
return dice;
39
}
40
41-
public static void printDicePairs (int[][] dicePairs){
42-
for (int[] pair: dicePairs) {
43-
for (int roll: pair) {
44
System.out.println(roll+" ");
45
}
46
System.out.println("");
47
}
48
}
49
50
public static int[][] addDicePairs(int [][] dicePairs){ // corrected: addDicePairs() to addDicePairs
(int[][] dicePairs)
51
int[] pairSums=new int[dicePairs.length];
52-
for (int x=0; x<pair Sums.length; x++) {
53
int sum=0;
54-
for(int y=0; y<dicePairs [x].length; y++) {
55
sum+=dicePairs [x][y];
56
}
57
pairSums [x]=sum;
58
}
59
return pairSums;
60
}
61
62-
public static void printDicePairs Sums (int[] dicePairSums) { //public static String to public static
void
63 -
for (int sum: dicePairSums) {
64
System.out.println(sum+" ");
65
}
66
67 }
W
10
}
Type here to search
O
0;
x
0
To use dictation, go to Settings and turn on online speech recognition
Learn Java App
G
Run
Output
Clear
• javac /tmp/ES4onxIySG/Main.java
/tmp/ES4onxIySG/Main.java:19: error: incompatible types: int[][] cannot be converted to int[]
int[] dicePairSums = addDicePairs(dicePairs); //corrected: int[][] dicePairSums to int[] dicePairSums
A
/tmp/ES4onxIySG/Main.java:20: error: cannot find symbol
printDicePairsSum(dicePairs); // name of function is incorrect so changed.
^
symbol: method printDicePairsSum(int[][])
location: class Main
/tmp/ES4onxIySG/Main.java:59: error: incompatible types: int[] cannot be converted to int[][]
return pairSums;
3 errors
29°C Mostly clear
ENG
9:54 pm
24/05/2022
:
1
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
- This Python script is full of syntax, runtime, and semantic errors. Please identify and correct these errors, such that code becomes fully executable and outputs the following message on the screen when running from the Git Bash command line The life expectancy for the millennials is projected to be 120 years! (But don't believe it...) A recent study published in the journal of Nature, discovered that over the past century, although life expectancy has significantly increased due to technological advances, the maximum life span of the oldest people in the world has not changed much. Cardano was the first to introduce complex numbers of the form a + sqrt(-b) into algebra, but he had misgivings about it. In his solution to an algebra equation, he encountered the solution 5 + sqrt(-15) for the unknown, which is now mathematically represented by (5+3.872983346207417j) in Python, which can also be obtained as the addition of real and imaginary numbers in Python like this 5 + sqrt(-15) =…arrow_forwardPython programming. Please provide a clear, simple, correct solution for the followingarrow_forwardPython AssertionError?arrow_forward
- Python help! How do I make code that when I input my name and age (as string variables), it converts it and prints it into ascii binary and numeric binary?arrow_forwardHow do I make this java encryption and decryption show different letter and not use the same words in a word E.g. Message: Character Message encrypt: Hmfwfhyjw Message decryption: Character So the letter a are switched out with f. I would all letters to be unique and not be the same Same with rarrow_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