In JAVA
Write a class that provides the following static methods to help with formatting and printing addresses:
method1
Returns the string “Mr.” concatenated with the String argument.
method2
Returns the string “Ms.” concatenated with the String argument.
method3
Takes a String argument containing a state. Returns the corresponding
abbreviation as String using the following :
Florida FL
Other ???
method4
Takes a String argument containing a city. Returns the corresponding
zip code as int using the following lookup table:
Boston 01841
Other 00000
method5
Takes name, street address, city, state, and zip code as arguments. Returns a
String concatenating each argument separated by the newline character.
Please find the code below:
StringOperations.java
package classes9;
public class StringOperations {
public static String method1(String str) {
return "Mr. "+str;
}
public static String method2(String str) {
return "Ms. "+str;
}
public static String method3(String state) {
if(state.equalsIgnoreCase("florida")){
return
"FL";
}else{
return
"???";
}
}
public static int method4(String state) {
if(state.equalsIgnoreCase("boston")){
return 1841;
//cannot return 01841
}else{
return
00000;
}
}
public static String method3(String name,String
streetAddress,String city,String state,String zip) {
return
name+"\n"+"\n"+streetAddress+"\n"+city+"\n"+state+"\n"+zip;
}
}
In JAVA Write a class that provides the following static methods to help with formatting and...
AddressHelper Written in - JAVA Write a class called AddressHelper that provides the following static methods to help with formatting and printing addresses: addMrPrefix() Returns the string “Mr. “ concatenated with the String argument. addMsPrefix() Returns the string “Ms. “ concatenated with the String argument. determineStateAbbreviation() Takes a String argument containing a state. Returns the corresponding abbreviation as String using the following lookup table: New York NY New Jersey NJ California CS Florida FL other -- determineZipcode() Takes a String...
(IN JAVA) Write a program named Review.java and implement the following methods: public static boolean isValidTicTacToeBoardString(String str) This method takes as its parameter a String that contains 9 characters representing the status of the Tic Tact Toe game. The String is mixed with X, O, x, o, and other letters. The first three letters represent the first row, letter 4 through letter 6 represent the second row, and the rest for the last row. To be considered as a valid...
FOR C++ PLEASE Create a class called "box" that has the following attributes (variables): length, width, height (in inches), weight (in pounds), address (1 line), city, state, zip code. These variables must be private. Create setter and getter functions for each of these variables. Also create two constructors for the box class, one default constructor that takes no parameters and sets everything to default values, and one which takes parameters for all of the above. Create a calcShippingPrice function that...