Slips
Slips
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class FactorialService {
@WebMethod
public int getFactorial(int num) {
if (num < 0) return -1;
int result = 1;
for (int i = 2; i <= num; i++) {
result *= i;
}
return result;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.FactorialService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class CurrencyConverter {
@WebMethod
public double convert(String type, double rupees) {
switch (type.toLowerCase()) {
case "dollar": return rupees / 83.0;
case "euro": return rupees / 90.0;
case "pound": return rupees / 103.0;
default: return -1.0;
}
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.CurrencyConverter;
package com.ws;
import java.time.LocalTime;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class GreetingService {
@WebMethod
public String greetUser(String name) {
LocalTime time = LocalTime.now();
int hour = time.getHour();
String greeting;
if (hour < 12) {
greeting = "Good Morning";
} else if (hour < 18) {
greeting = "Good Afternoon";
} else {
greeting = "Good Evening";
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.GreetingService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class TemperatureConverter {
@WebMethod
public double convertCtoF(double celsius) {
return (celsius * 9 / 5) + 32;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.TemperatureConverter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class WeightConverter {
@WebMethod
public double kgToGram(double kg) {
return kg * 1000;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.WeightConverter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class EmailValidator {
@WebMethod
public boolean validateEmail(String email) {
return email.matches("^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+$");
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.EmailValidator;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class GeometryService {
@WebMethod
public double calculateArea(double length, double width) {
return length * width;
}
@WebMethod
public double calculateVolume(double length, double width, double height) {
return length * width * height;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.GeometryService;
package com.ws;
import java.sql.*;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class StaffService {
@WebMethod
public String getStaffDetails(String name) {
String output = "Staff Not Found";
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/college", "root",
"password");
PreparedStatement ps = con.prepareStatement("SELECT * FROM staff WHERE sname = ?");
ps.setString(1, name);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
output = "Staff No: " + rs.getInt("sno") +
", Name: " + rs.getString("sname") +
", Designation: " + rs.getString("designation") +
", Salary: " + rs.getDouble("salary");
}
con.close();
} catch (Exception e) {
output = "Error: " + e.getMessage();
}
return output;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.StaffService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class FactorialService {
@WebMethod
public int getFactorial(int num) {
if (num < 0) return -1;
int result = 1;
for (int i = 2; i <= num; i++) {
result *= i;
}
return result;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.FactorialService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
import java.util.HashMap;
import java.util.Map;
@WebService
public class StationaryService {
static {
itemPrices.put("pen", 10.0);
itemPrices.put("pencil", 5.0);
itemPrices.put("notebook", 30.0);
itemPrices.put("eraser", 3.0);
itemPrices.put("marker", 20.0);
}
@WebMethod
public double getItemPrice(String itemName) {
return itemPrices.getOrDefault(itemName.toLowerCase(), -1.0);
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.StationaryService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class VowelCounter {
@WebMethod
public int countVowels(String input) {
int count = 0;
input = input.toLowerCase();
for (char c : input.toCharArray()) {
if ("aeiou".indexOf(c) != -1) {
count++;
}
}
return count;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.VowelCounter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
import java.util.HashMap;
import java.util.Map;
@WebService
public class LoginValidator {
static {
users.put("admin", "admin123");
users.put("user", "user123");
}
@WebMethod
public boolean validate(String username, String password) {
return users.containsKey(username) && users.get(username).equals(password);
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.LoginValidator;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class WeightConverter {
@WebMethod
public double kgToGram(double kg) {
return kg * 1000;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.WeightConverter;
package com.ws;
import java.sql.*;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class StaffService {
@WebMethod
public String getStaffDetails(String name) {
String output = "Staff Not Found";
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/college", "root",
"password");
PreparedStatement ps = con.prepareStatement("SELECT * FROM staff WHERE sname = ?");
ps.setString(1, name);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
output = "Staff No: " + rs.getInt("sno") +
", Name: " + rs.getString("sname") +
", Designation: " + rs.getString("designation") +
", Salary: " + rs.getDouble("salary");
}
con.close();
} catch (Exception e) {
output = "Error: " + e.getMessage();
}
return output;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.StaffService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class GeometryService {
@WebMethod
public double calculateArea(double length, double width) {
return length * width;
}
@WebMethod
public double calculateVolume(double length, double width, double height) {
return length * width * height;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.GeometryService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class PercentageCalculator {
@WebMethod
public double calculatePercentage(int m1, int m2, int m3, int m4, int m5) {
int total = m1 + m2 + m3 + m4 + m5;
return (total / 500.0) * 100;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.PercentageCalculator;
package com.ws;
import java.time.LocalTime;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class GreetingService {
@WebMethod
public String greetUser(String name) {
LocalTime time = LocalTime.now();
int hour = time.getHour();
String greeting;
if (hour < 12) {
greeting = "Good Morning";
} else if (hour < 18) {
greeting = "Good Afternoon";
} else {
greeting = "Good Evening";
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.GreetingService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class MobileValidator {
@WebMethod
public boolean validateMobile(String mobile) {
return mobile.matches("^[0-9]{10}$");
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.MobileValidator;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class WeightConverter {
@WebMethod
public double kgToGram(double kg) {
return kg * 1000;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.WeightConverter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class CurrencyConverter {
@WebMethod
public double convert(String type, double rupees) {
switch (type.toLowerCase()) {
case "dollar": return rupees / 83.0;
case "euro": return rupees / 90.0;
case "pound": return rupees / 103.0;
default: return -1.0;
}
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.CurrencyConverter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class VowelCounter {
@WebMethod
public int countVowels(String input) {
int count = 0;
input = input.toLowerCase();
for (char c : input.toCharArray()) {
if ("aeiou".indexOf(c) != -1) {
count++;
}
}
return count;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.VowelCounter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class NumberConverter {
@WebMethod
public String convert(int number, String type) {
switch (type.toLowerCase()) {
case "binary": return Integer.toBinaryString(number);
case "octal": return Integer.toOctalString(number);
case "hex": return Integer.toHexString(number).toUpperCase();
default: return "Invalid type";
}
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.NumberConverter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class GeometryService {
@WebMethod
public double calculateArea(double length, double width) {
return length * width;
}
@WebMethod
public double calculateVolume(double length, double width, double height) {
return length * width * height;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.GeometryService;
package com.ws;
import java.sql.*;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class LoginService {
@WebMethod
public boolean validateLogin(String username, String password) {
boolean isValid = false;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/college", "root",
"password");
PreparedStatement ps = con.prepareStatement("SELECT * FROM users WHERE username=? AND
password=?");
ps.setString(1, username);
ps.setString(2, password);
ResultSet rs = ps.executeQuery();
isValid = rs.next();
con.close();
} catch (Exception e) {
e.printStackTrace();
}
return isValid;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.LoginService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class VowelCounter {
@WebMethod
public int countVowels(String input) {
int count = 0;
input = input.toLowerCase();
for (char c : input.toCharArray()) {
if ("aeiou".indexOf(c) != -1) {
count++;
}
}
return count;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.VowelCounter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class CurrencyConverter {
@WebMethod
public double convert(String type, double rupees) {
switch (type.toLowerCase()) {
case "dollar": return rupees / 83.0;
case "euro": return rupees / 90.0;
case "pound": return rupees / 103.0;
default: return -1.0;
}
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.CurrencyConverter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class FactorialService {
@WebMethod
public int getFactorial(int num) {
if (num < 0) return -1;
int result = 1;
for (int i = 2; i <= num; i++) {
result *= i;
}
return result;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.FactorialService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class TemperatureConverter {
@WebMethod
public double convertCtoF(double celsius) {
return (celsius * 9 / 5) + 32;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.TemperatureConverter;
package com.ws;
import java.time.LocalTime;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class GreetingService {
@WebMethod
public String greetUser(String name) {
LocalTime time = LocalTime.now();
int hour = time.getHour();
String greeting;
if (hour < 12) {
greeting = "Good Morning";
} else if (hour < 18) {
greeting = "Good Afternoon";
} else {
greeting = "Good Evening";
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.GreetingService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class EmailValidator {
@WebMethod
public boolean validateEmail(String email) {
return email.matches("^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+$");
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.EmailValidator;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class WeightConverter {
@WebMethod
public double kgToGram(double kg) {
return kg * 1000;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.WeightConverter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
import java.util.HashMap;
import java.util.Map;
@WebService
public class StationaryService {
static {
itemPrices.put("pen", 10.0);
itemPrices.put("pencil", 5.0);
itemPrices.put("notebook", 30.0);
itemPrices.put("eraser", 3.0);
itemPrices.put("sharpener", 7.0);
}
@WebMethod
public double getItemPrice(String itemName) {
return itemPrices.getOrDefault(itemName.toLowerCase(), -1.0);
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.StationaryService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class GeometryService {
@WebMethod
public double calculateArea(double length, double width) {
return length * width;
}
@WebMethod
public double calculateVolume(double length, double width, double height) {
return length * width * height;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.GeometryService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class MobileValidator {
@WebMethod
public boolean validateMobile(String mobile) {
return mobile.matches("^[0-9]{10}$");
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.MobileValidator;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class VowelCounter {
@WebMethod
public int countVowels(String input) {
int count = 0;
input = input.toLowerCase();
for (char c : input.toCharArray()) {
if ("aeiou".indexOf(c) != -1) {
count++;
}
}
return count;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.VowelCounter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class PercentageCalculator {
@WebMethod
public double calculatePercentage(int m1, int m2, int m3, int m4, int m5) {
int total = m1 + m2 + m3 + m4 + m5;
return (total / 500.0) * 100;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.PercentageCalculator;
package com.ws;
import java.time.LocalTime;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class GreetingService {
@WebMethod
public String greetUser(String name) {
LocalTime time = LocalTime.now();
int hour = time.getHour();
String greeting;
if (hour < 12) {
greeting = "Good Morning";
} else if (hour < 18) {
greeting = "Good Afternoon";
} else {
greeting = "Good Evening";
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.GreetingService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class NumberConverter {
@WebMethod
public String convert(int number, String type) {
switch (type.toLowerCase()) {
case "binary": return Integer.toBinaryString(number);
case "octal": return Integer.toOctalString(number);
case "hex": return Integer.toHexString(number).toUpperCase();
default: return "Invalid type";
}
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.NumberConverter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class FactorialService {
@WebMethod
public int getFactorial(int num) {
if (num < 0) return -1;
int result = 1;
for (int i = 2; i <= num; i++) {
result *= i;
}
return result;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.FactorialService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class MobileValidator {
@WebMethod
public boolean validateMobile(String mobile) {
return mobile.matches("^[0-9]{10}$");
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.MobileValidator;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class WeightConverter {
@WebMethod
public double kgToGram(double kg) {
return kg * 1000;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.WeightConverter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class TemperatureConverter {
@WebMethod
public double convertCtoF(double celsius) {
return (celsius * 9 / 5) + 32;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.TemperatureConverter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class VowelCounter {
@WebMethod
public int countVowels(String input) {
int count = 0;
input = input.toLowerCase();
for (char c : input.toCharArray()) {
if ("aeiou".indexOf(c) != -1) {
count++;
}
}
return count;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.VowelCounter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class MobileValidator {
@WebMethod
public boolean validateMobile(String mobile) {
return mobile.matches("^[0-9]{10}$");
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.MobileValidator;
package com.ws;
import java.time.LocalTime;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class GreetingService {
@WebMethod
public String greetUser(String name) {
LocalTime time = LocalTime.now();
int hour = time.getHour();
String greeting;
if (hour < 12) {
greeting = "Good Morning";
} else if (hour < 18) {
greeting = "Good Afternoon";
} else {
greeting = "Good Evening";
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.GreetingService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
import java.util.HashMap;
import java.util.Map;
@WebService
public class StationaryService {
static {
prices.put("pen", 10.0);
prices.put("pencil", 5.0);
prices.put("notebook", 30.0);
}
@WebMethod
public double getItemPrice(String item) {
return prices.getOrDefault(item.toLowerCase(), -1.0);
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.StationaryService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class FactorialService {
@WebMethod
public int getFactorial(int num) {
if (num < 0) return -1;
int result = 1;
for (int i = 2; i <= num; i++) {
result *= i;
}
return result;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.FactorialService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class TemperatureConverter {
@WebMethod
public double convertCtoF(double celsius) {
return (celsius * 9 / 5) + 32;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.TemperatureConverter;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class GeometryService {
@WebMethod
public double calculateArea(double length, double width) {
return length * width;
}
@WebMethod
public double calculateVolume(double length, double width, double height) {
return length * width * height;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.GeometryService;
package com.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class PercentageCalculator {
@WebMethod
public double calculatePercentage(int m1, int m2, int m3, int m4, int m5) {
int total = m1 + m2 + m3 + m4 + m5;
return (total / 500.0) * 100;
}
}
package com.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.ws.PercentageCalculator;