QA › Programming

Programming answers to 40 questions

Simply insert this condition: if (userAge >= 18 && userAge <= 25) {
204 Views
Generally, primitive data types is Java include char, float, double, boolean, short, int, long, byte. In turn, non-primitive types are classes, arrays, and string. So, the correct answer is A - String
205 Views
All you need to do here is to changes the lines order. #include <iostream> using namespace std; int main() { int userNum; cout<<"Enter a number"<<endl; cin >> userNum; if (userNum > 0){ cout << "Positive." << endl; } else{ cout…
152 Views
Answer: avgKids = static_cast<double>(numKidsA + numKidsB + numKidsC) / static_cast<double>(numFamilies);  
209 Views
Hi! That's simple - just insert this string: if (userInput.at(0) == firstLetter) {
207 Views
Here's your solution, integrated into the code: #include #include #include using namespace std; int main() { bool hasDigit; string passCode; hasDigit = false; passCode = "abc"; /* Your solution goes here */ if (isdigit(passCode.at(0)) || isdigit(passCode.at(1)) || isdigit(passCode.at(2))) { hasDigit…
339 Views
The port is what we call HDMI, that is, High- Definition Multimedia Interface in full. The HDMI is a computer port that can be used to communicate video and audio data from a source with HDMI to another. That is,…
142 Views
import java.util.Scanner; public class Test { public static void main(String args[]) { Scanner s = new Scanner(System.in); System.out.println("Enter the radius of a circle: "); double radius; do { double temp = s.nextDouble(); radius = (temp < 0) ? -1 :…
137 Views
<p style="background-color:grey;color:green;">your text your text </p>
149 Views
#include <stdlib.h> /* rand() */ #include <time.h> /* time() */ #include <stdio.h> /* printf() */ #define N_OF_FRIENDS 3 #define MAX_MOTHER_CARE 10 #define MIN_MOTHER_CARE 1 int main() { const unsigned SIZE = N_OF_FRIENDS; int ArrayA[N_OF_FRIENDS] = { 0 }; /* initialize…
135 Views