Exception in thread "main" java.lang.Error: Unresolved compilation problem: at CardPointsList.main(empty.java:83)
Exception in thread "main" java.lang.Error: Unresolved compilation problem: at CardPointsList.main(empty.java:83)
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
I'm having trouble to compile and run this Java code in visual studio code as there's only an error in the main function.
import java.util.HashMap;
import java.io.*;
public class CardPointsList {
static HashMap<String,Integer> Code = new HashMap<>();
static HashMap<Character,Integer> Order = new HashMap<>();
static String[][] hand= {{ "c5","s6","sK","dK","dA"},{"s7","s4","dJ","sA","h5"},{"sQ","d3","c9","hK","d5"}};
static int[] scores={0,0,0};
public static void sortHand()
{ String temp;
for (int h=0;h<3;h++)
{for (int i=0;i<5;i++)
{ for (int j=i+1;j<5;j++)
{ if (hand[h][j].charAt(0) < hand[h][i].charAt(0))
{temp = hand[h][j];
hand[h][j] = hand[h][i];
hand[h][i] = temp;
}
else
if (hand[h][j].charAt(0) == hand[h][i].charAt(0))
{ if (Order.get(hand[h][j].charAt(1)) < Order.get(hand[h][i].charAt(1)))
{temp = hand[h][j];
hand[h][j] = hand[h][i];
hand[h][i] = temp;
}
}
} //for j
} // for i
}// for h
}
public static void printHand()
{ for (int h=0;h<3;h++) {
for (int i=0;i<5;i++)
{ System.out.println(hand[h][i]);}
System.out.println();
}
}
public static void getPoints( )
{ int total=0;
for (int h=0;h<3;h++)
{
for (int i=0;i<5;i++)
{ String myStr = Character.toString(hand[h][i].charAt(1));
total += Code.get(myStr);
}
scores[h]=total;
System.out.println(scores[h]);
total=0;
}
}
public static int getmax()
{ int max=0;
int handNum=0;
for (int h=0;h<3;h++)
{ if (scores[h]>max)
{max=scores[h];
handNum=h;
}
}
System.out.println("Maximum points :" + max);
return handNum+1;
}
public static void main(String[] args) throws IOException {
Code.put("A",1);
Code.put("2",2);
Code.put("3",3);
Code.put("4",4);
Code.put("5",5);
Code.put("6",6);
Code.put("7",7);
Code.put("8",8);
Code.put("9",9);
Code.put("X",10);
Code.put("J",10);
Code.put("K",10);
Code.put("Q",10);
Order.put('A',1);
Order.put('2',2);
Order.put('3',3);
Order.put('4',4);
Order.put('5',5);
Order.put('6',6);
Order.put('7',7);
Order.put('8',8);
Order.put('9',9);
Order.put('X',10);
Order.put('K',11);
Order.put('Q',12);
Order.put('J',13);
sortHand();
printHand();
getPoints();
int maxh=getmax();
System.out.println("Maximum points are for hand " + maxh);
}
}
![Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at CardPointsList.main(empty.java:83)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F34b23c88-1540-45b6-8988-2b688f0ea40c%2Fcf0d35b5-e6d5-4fcf-97c0-9b06d77e770b%2Frvetdef_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at CardPointsList.main(empty.java:83)
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
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 now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
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.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education