Question: Suppose that the scores are stored in the Scores table. The table was created as follows: create table Scores (name varchar(20), score number, permission boolean);

Suppose that the scores are stored in the Scores table. The table was created as follows:

create table Scores (name varchar(20),
score number, permission boolean);
insert into Scores values (‘John’, 90.5, 1);
insert into Scores values (’Michael’, 100, 1);
insert into Scores values (’Michelle’, 100, 0);

Revise the findScore method in Listing 41.1, ScoreService.java, to obtain a score for the specified name. Note that your program does not need the permission column; ignore it. The next exercise will need the permission column.

Data from Listing 41.1,

LISTING 41.1 ScoreService.java 1 package chapter41; 2 3 import java.util.HashMap; 4 import



LISTING 41.1 ScoreService.java 1 package chapter41; 2 3 import java.util.HashMap; 4 import javax.jws.WebService; // For annotation @WebService 5 import javax.jws.WebMethod; // For annotation @WebMethod 6 7 eWebService (name = "ScoreService", serviceName = "ScorewebService") 8 public class ScoreService { 9 // Stores scores in a map indexed by name private HashMap scores = new HashMap (); 10 11 12 public ScoreService () { scores.put ("John", 90.5); scores.put ("Michael", 100.0); scores.put ("Michelle", 98.5); } 13 14 15 16 17 18 19 eWebMethod (operationName = "findScore") public double findScore(String name) { Double d = scores.get (name); 20 21 22 if (d == null) { System.out.println("Student return -1; 23 24 + name + is not found "); 25 26 } else { System.out.println("Student " + name + "l's score is " + d.doubleValue ()); return d.doubleValue(); } } } 27 28 29 30 31 32 33

Step by Step Solution

3.41 Rating (167 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Revised findScore Method WebMethod operationName findScore pu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction to Java Programming and Data Structure Questions!