Q1:
1. Go into the bathroom
2. Put toothpaste on the toothbrush
3. Place head of toothbrush on your teeth
4. Revolve in small circles
5. Repeat 4 for all of your teeth
6. Use water to wash away the toothpaste in you mouth
Answer:
public class num3 {
public static String swapValues(int userVal1, int userVal2){
int temp = userVal2;
userVal2 = userVal1;
userVal1 = temp;
return(userVal1+", "+userVal2);
}
public static void main(String[] args) {
int val1 = 5;
int val2 = 8;
System.out.println("Original values");
System.out.println(val1+", "+val2);
System.out.println("Swapped Values");
System.out.println(swapValues(val1,val2));
}
}
Explanation:
- The problem is solved with Java programming language
- Define the method swapValues() to accept two ints and return a String
- Within the method body, create a temp variable to hold the value of userVal2 temporary
- Do the following re-assignment of values userVal2 = userVal1; userVal1 = temp;
- Return the concatenated String userVal1+", "+userVal2
- Create two variables and initialize them in the main method
- Output their values
- Call swapValues() aand output the swapped values
Plagiarism is a crime, flat out. It is unethical and immoral to copy, verbatim, another persons work and claim it as your own, especially for scholastic uses. In order to avoid plagiarism, it is important that we give accurate references and paraphrase, rather that copy and paste information. It is important to consider the widespread effect of plagiarism. It effects all involved: The student, the owner of the information, the instructor, and even the site from which the information was stolen. Use the proper channels and be honest when completing assignments goes a long way. We must do what we can to prevent plagiarism, starting with ourselves and our own research. <span />