Answer:
import java.util.Scanner;
public class num5 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter your full name");
String name = in.nextLine();
String [ ] n = name.split(" ");
System.out.println(n[0]+", "+n[1]);
}
}
Explanation:
Scanner class is used to receive the full names. e.g "Maya Jones"
This is saved in a variable called name using the nextLine() method to grab the entire line of string
The string split() method is used to split the string on the whitespace
The output statement is used to print the value at index 0 and index 1 concatenated with a comma.
Answer:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
const int NUM_VALS = 4;
vector<int> userValues(NUM_VALS);
int i = 0;
int matchValue = 0;
int numMatches = -99; // Assign numMatches with 0 before your for loop
userValues.at(0) = 2;
userValues.at(1) = 2;
userValues.at(2) = 1;
userValues.at(3) = 2;
matchValue = 2;
numMatches=0;
//loop to iterate elements of userValues
for(int i=0; i<NUM_VALS; i++)
{
//check the matchValue with every element of the userValues using index
if(userValues.at(i)==matchValue)
numMatches++;
}
//STUDENT CODE
//print the result
cout << "matchValue: " << matchValue << ", numMatches: " << numMatches << endl;
return 0;
}
Explanation:
<span>This is a common corny joke told frequently at dinner parties or some other form of social gathering. The punchline is because they heard it was a waist of energy, waist being a pun on waste, this is the kind of joke that could also be described as a "dad joke".</span>
Answer:
C
Explanation:
beacuse you need to be respectful and smart.