I'm going to assume this is Java, because you said "method" meaning it will be some sort of object oriented language, and Java's really common. Here would be the full program, but you can just take the method out isolated if you need it.
package lastname;
public class LastName {
public static void main(String[] args) {
// Example usage:
String name = LastName.lastName("Garrett Acord");
System.out.println(name);
// Output: Acord G.
}
public static String lastName(String fullName)
{
String[] splitName = fullName.split(" ");
return String.format("%s %s.", splitName[1], splitName[0].substring(0,1) );
}
}
Answer:
Hi, for this exercise we have two laws to bear in mind:
Morgan's laws
NOT(А).NOT(В) = NOT(A) + NOT (B)
NOT(A) + NOT (B) = NOT(А).NOT(В)
And the table of the Nand
INPUT OUTPUT
A B A NAND B
0 0 1
0 1 1
1 0 1
1 1 0
Let's start!
a.
Input OUTPUT
A A A NAND A
1 1 0
0 0 1
b.
Input OUTPUT
A B (A NAND B ) NAND (A NAND B )
0 0 0
0 1 0
1 0 0
1 1 1
C.
Input OUTPUT
A B (A NAND A ) NAND (B NAND B )
0 0 0
0 1 1
1 0 1
1 1 1
Explanation:
In the first one, we only need one input in this case A and comparing with the truth table we have the not gate
In the second case, we have to negate the AND an as we know how to build a not, we only have to make a nand in the two inputs (A, B) and the make another nand with that output.
In the third case we have that the OR is A + B and we know in base of the morgan's law that:
A + B = NOT(NOT(А).NOT(В))
So, we have to negate the two inputs and after make nand with the two inputs negated.
I hope it's help you.
Either A or B. I would go with A but It can actually be B
Answer:
see explaination
Explanation:
import java.util.ArrayList;
import java.util.Arrays;
public class Merge {
public static ArrayList<String> mergeList(ArrayList<String> lst1, ArrayList<String> lst2) {
ArrayList<String> result = new ArrayList<String>();
int i = 0, j = 0;
while (i < lst1.size() || j < lst2.size()) {
if (i < lst1.size() && (j >= lst2.size() || lst1.get(i).compareTo(lst2.get(j)) < 0)) {
result.add(lst1.get(i++));
} else {
result.add(lst2.get(j++));
}
}
return result;
}
public static void main(String[] args) {
ArrayList<String> lst1 = new ArrayList<>(Arrays.asList("Austin", "Dallas", "San Fransisco"));
ArrayList<String> lst2 = new ArrayList<>(Arrays.asList("Boston", "Chicago", "Denver", "Seattle"));
System.out.println(mergeList(lst1, lst2));
}
}
Answer:
When searching for articles using library databases, the following tips should increase the relevance of your results. Quotation marks around two or more keywords - phrase searching - ensures that the results will include the exact phrase.
Explanation: