Exercise 1
• Examine ShoppingCart.java.
– Perform the following:
– Use the indexOf method to get the index for the spacecharacter (” “) within custName. Assign it to spaceIdx.
– Use the substring method and spaceIdx to get the first nameportion of custName. Assign it to firstName and printfirstName.
public class ShoppingCart {
public static void main (String[] args){
String custName =”Steve Smith”;
String firstName;
int spaceIdx;
// Get the index ofthe space character (” “) in custName.
// Use the substringmethod parse out the first name and print it.
}
}
Exercise 2
Examine NameMaker.java.
• Perform the following:
– Declare String variables: firstName, middleName, lastName, andfullName
– Prompt users
PayPal Gateway not configured
PayPal Gateway not configured