In this labs, we will create a service converting cm to inch and another service calculating the ideal weight (in kg) based on a height (in cm). These services contain two operations and are deployed on the same server. The response messages of the second service include two parameters: men's and women's weight.
The deployment is somehow similar to the previous lab.
package tps.multi.ws; public class ConverterWS { public static double inch_to_cm (double inch){ return 2.54*inch; } public static double cm_to_inch (double cm){ return 0.3937*cm; } }
package tps.multi.ws; public class IdealWeight { public double men_weight_in_kg; public double women_weight_in_kg; public double getMenWeight(){return men_weight_in_kg;} public double getWomenWeight(){return women_weight_in_kg;} }
package tps.multi.ws; public class IdealWeightWS { public IdealWeight devineFormula(double height_in_cm){ IdealWeight iw = new IdealWeight(); iw.men_weight_in_kg = 50 + 2.3*(ConverterWS.cm_to_inch(height_in_cm)-60); iw.women_weight_in_kg = 45.5 + 2.3*(ConverterWS.cm_to_inch(height_in_cm)-60); return iw; } public IdealWeight millerFormula(double height_in_cm){ IdealWeight iw = new IdealWeight(); iw.men_weight_in_kg = 56.2 + 1.41*(ConverterWS.cm_to_inch(height_in_cm)-60); iw.women_weight_in_kg = 53.1 + 1.36*(ConverterWS.cm_to_inch(height_in_cm)-60); return iw; } }