I believe the answer is A. because he has to listen to what the people tell him and he information he has to think about and make a choice on what to reply with.
I hope this helps and its correct please let me know if its wrong have a great day//night.
Adjust list by normalizing When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by subtracting the smallest value from all the values. The input begins with an integer indicating the number of integers that follow. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5 30 50 10 70 65 the output is: 20 40 0 60 55 The 5 indicates that there are five values in the list, namely 30, 50, 10, 70, and 65. 10 is the smallest value in the list, so is subtracted from each value in the list. For coding simplicity, follow every output value by a space, including the last one.
Answer:
I've implemented this program using python
userinput = int(input("Length: "))
mylist = []
mylist.append(userinput)
for i in range(1,userinput+1):
userinp = int(input("Input: "))
mylist.append(userinp)
smallval = mylist[1]
for i in range(1,len(mylist)):
if smallval > mylist[i]:
smallval = mylist[i]
for i in range(1,len(mylist)):
mylist[i] = mylist[i] - smallval
for i in range(1,len(mylist)):
print(mylist[i],end=' ')
Explanation:
I've added the full source program as an attachment where I used comments to explain difficult lines
The program written in python 3 deducts the least from a list of user given integers and prints the output. The program goes thus :
len_input = int(input())
#the number of inputs the user wishes to supply
vals = []
#initialize an empty list to accept the inputs
for i in range(1, len_input +1):
#use a loop to accept the user inputs
num = int(input())
#allow users to take in the inputs
vals.append(num)
#append each value to the list
least =min(vals)
#using the min function, obtain the lowest value from the list
output_vals = []
#initialize an empty list to hold the normalized values
for i in range(len_input):
#loop using a for loop
diff = vals[i] - least
#deduct the minimum value from each element in the list
output_vals.append(diff)
#append the values to the new list.
print(output_vals)
#display the output
A sample run of the program and the script is attached.
Learn more :https://brainly.com/question/14276852
WILL GIVE BRAINLYIEST 3pts) Make a prediction about which material will be the best insulator and conductor of heat. Materials: aluminum, glass, fiber glass, air between glass, and brick:
a. I think the _____________ will conduct heat better.
b. I think the _____________ will insulate heat better.
Answer:
a. I think the Aluminum will conduct heat better.
b. I think the Fiberglass will insulate heat better.
Fiberglass is used to insulate most everyday items, so I can be sure that fiberglass can be the best insulator, as for aluminum it conducts heat like you wouldn't believe.
Note: Your answer doesn't have to be right, they just want you to make a prediction about your answer, that means it's alright to guess, also know I didn't guess I am just telling you that you didn't have to ask this question. <3
Roger's camera battery had a short circuit, which caused a fire at his home. What could he have done to prevent this from happening? A left batteries in camera when not in use B. stored batteries with other metal objects c. kept batteries near a magnetic field D. removed the batteries from the camera
Answer: D
Explanation: Because if he took the battery out it would not have short circuited.
The code below is supposed to display the name and score for the student with the highest score one time before the program ends. It is displaying Jim as the student with the highest score. It is displaying the highest score of 95. Unfortunately, Jim does not have a score of 95. Correct the following code:
Declare String students[SIZES] = {"Jen", "Jon", "Jan", "Joe", "Jim"}
Declare Integer scores[SIZES] = 70, 85, 72, 95, 90
Declare Integer index Declare Integer highest = scores[0]
Declare Integer highest Name = " " For index = 0
To SIZES //Assume that this translates to For (index = 0; index <= SIZES, index ++)
If scores[index] > highest then highest = scores[index]
End Of highestName = students[index]
End For Display "
The name of the student with the highest score is ", highest Name Display "The highest score is ", highest
Answer:
Modify
If scores[index] > highest then highest = scores[index]
End Of highest
Name = students[index]
End For Display
to
If scores[index] > highest then highest = scores[index]
Name = students[index]
End Of highest
End For Display
Explanation:
In the code, you posted the code segment that gets the name of the student with the highest score is outside the if condition that determines the highest.
To make correction, we only need to bring this code segment into the loop.
See Answer
Convert the following C program to C++.
More instructions follow the code.
#include
#include
#define SIZE 5
int main(int argc, char *argv[]) {
int numerator = 25;
int denominator = 10;
int i = 0;
/*
You can assume the files opened correctly and the
correct number of of command-line arguments were
entered.
*/
FILE * inPut = fopen(argv[1], "r");
FILE * outPut = fopen(argv[2], "w");
float result = (float)numerator/denominator;
fprintf(outPut,"Result is %.2f\n", result);
float arr[SIZE];
for( ; i < SIZE; i++) {
fscanf(inPut, "%f", &arr[i]);
fprintf(outPut, "%7.4f\n", arr[i]);
}
return 0;
}
Notice this is uses command-line arguments. I have provided an input file called num.txt that will be used when running the program. The output file is called out.txt.
Make sure you are using C++ style file I/O (FILE pointers/fopen) as well as regular I/O including the C++ style output formatting (fscanf, fprintf, formatting). Also use the C++ method of casting. The lines above that are bold are the lines that you need to convert to C++. Don't forget to add the necessary C++ statements that precede the main() function.
Answer:
The program equivalent in C++ is:
#include <cstdio>
#include <cstdlib>
#define SIZE 5
using namespace std;
int main(int argc, char *argv[]) {
int numerator = 25;
int denominator = 10;
FILE * inPut = fopen(argv[1], "r");
FILE * outPut = fopen(argv[2], "w");
float result = (float)numerator/denominator;
fprintf(outPut,"Result is %.2f\n", result);
float arr[SIZE];
for(int i = 0; i < SIZE; i++) {
fscanf(inPut, "%f", &arr[i]);
fprintf(outPut, "%7.4f\n", arr[i]);
}
return 0;
}
Explanation:
See attachment for explanation.
Each line were numbered with equivalent line number in the C program
Write a program that reads in 10 numbers from the user and stores them in a 1D array of size 10. Then, write BubbleSort to sort that array – continuously pushing the largest elements to the right side
Answer:
The solution is provided in the explanation section.
Detailed explanation is provided using comments within the code
Explanation:
import java.util.*;
public class Main {
//The Bubble sort method
public static void bb_Sort(int[] arr) {
int n = 10; //Length of array
int temp = 0; // create a temporal variable
for(int i=0; i < n; i++){
for(int j=1; j < (n-i); j++){
if(arr[j-1] > arr[j]){
// The bubble sort algorithm swaps elements
temp = arr[j-1];
arr[j-1] = arr[j];
arr[j] = temp;
}
}
}
}
public static void main(String[] args) {
//declaring the array of integers
int [] array = new int[10];
//Prompt user to add elements into the array
Scanner in = new Scanner(System.in);
//Use for loop to receive all 10 elements
for(int i = 0; i<array.length; i++){
System.out.println("Enter the next array Element");
array[i] = in.nextInt();
}
//Print the array elements before bubble sort
System.out.println("The Array before bubble sort");
System.out.println(Arrays.toString(array));
//Call bubble sort method
bb_Sort(array);
System.out.println("Array After Bubble Sort");
System.out.println(Arrays.toString(array));
}
}
Create a class named Invoicing that includes three overloaded computeInvoice() methods for a book store: see pages 196 for examples… The 8% tax should be defined as a constant.
1. When computeInvoice() receives a single parameter, it represents the price of one book ordered. Add 8% tax and display the total due.
2. When computeInvoice() receives two parameters, they represent the price of a book and the quantity ordered. Multiply the two values, add 8% tax, and display the total due.
3. When computeInvoice() receives three parameters, they represent the price of a book, the quantity ordered, and a coupon value. Multiply the quantity and price, reduce the result by the coupon value, and then add 8% tax and display the total due.
Create a driver class named TestInvoice with a main() method that tests all three overloaded methods using the following data: Price $24.95 Price, $17.50, quantity 4, Price $10.00, quantity 6, coupon $20.00 Output printed to Eclipse Console:
Price $26.95
Price $76.95
Price $43.20
Answer:
Follows are the method to this question:
class Invoicing //defining a class Invoicing
{
public static final double Tax = 8.0; //defining static variable Tax that holds a value
public static double Total;//defining a double variable Total
public void computeInvoice(double p1)//defining method computeInvoice that take double parameter
{
Total = p1 + p1 * (Tax / 100);//defining double variable Total that holds Price value
System.out.printf("Price $%.2f\n" , Total);//print calculated value
}
public void computeInvoice(double p2, int q)//defining method computeInvoice that takes integer and double parameter
{
Total = p2 * q;//use Total variable that calculate Price with Tax
Total = Total + (Total * (Tax/ 100));//calculate taxes on Total
System.out.printf("Price $%.2f\n" , Total);//print calculated value
}
public void computeInvoice(double p3, int q, double c)//defining method computeInvoice that takes one integer and two-double parameter
{
Total = p3 * q;//use Total to calculate Total price
Total = Total - c;//remove coupon amount from Total amount
Total = Total + (Total * (Tax/ 100));//calculate taxes on Total
System.out.printf("Price $%.2f\n" , Total);//print calculated value
}
}
public class TestInvoice //defining Main class TestInvoice
{
public static void main(String[] ar)//defining main method
{
Invoicing obm = new Invoicing ();//creating Invoicing class object obm
obm.computeInvoice(24.95);//calling method computeInvoice
obm.computeInvoice(17.5, 4);//calling method computeInvoice
obm.computeInvoice(10, 6, 20);//calling method computeInvoice
}
}
Output:
please find attached file.
Explanation:
In the above-given code, a class "Invoicing" is defined, inside the class two static double variable "Total and Tax" is defined, in which the Tax variable holds a value that is "8.0".
In class three same method, "computeInvoice" is used that accepts a different parameter for providing method overloading, which can be defined as follows:
In the first method, it accepts a single double parameter "p1", and inside the method, it uses the "Total" variable to calculate price value.In the second method, it accepts one integer and one double parameter "q and p2", and inside the method, it uses the "Total" variable is used to calculate the price with tax and print its value.In the third method, it accepts one integer and two double parameters "q, p3, and c", and inside the method, it uses the "Total" variable is used to calculate the price with tax and include tax and print its value.In the next step, the main class "TestInvoice" is defined inside the main method, Invoicing object is created and call its method.Write a C program to input basic salary of an employee and calculate gross salary according to given conditions.
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary is between 10001 to 20000 : HRA = 25%, DA = 90%
Basic Salary >= 20001 : HRA = 30%, DA = 95%
Your program must calculate each employee's gross pay amount.
Answer:
Written in C
#include <stdio.h>
int main() {
float salary;
printf("Salary: ");
scanf("%f", &salary);
float HRA, DA;
if(salary <= 10000){
HRA = 0.20; DA = 0.80;
}
else if(salary >= 10000 && salary <= 20000){
HRA = 0.25; DA = 0.90;
}
else{
HRA = 0.30; DA = 0.95;
}
salary = salary + salary * HRA + salary * DA;
printf("Gross Salary: %.2f\n", salary);
return 0;
}
Explanation:
I've added the full program as an attachment where I used comments as explanation
Plz answer me will mark as brainliest
Answer:
7. true
8.B
Hopefully those are correct!
Explanation:
Write code that prints: Ready! numVal ... 2 1 Start! Your code should contain a for loop. Print a newline after each number and after each line of text Ex: numVal
Answer:
Written in Python
numVal = int(input("Input: "))
for i in range(numVal,0,-1):
print(i)
print("Ready!")
Explanation:
This line prompts user for numVal
numVal = int(input("Input: "))
This line iterates from numVal to 1
for i in range(numVal,0,-1):
This line prints digits in descending order
print(i)
This line prints the string "Ready!"
print("Ready!")
how many basic element makes up a computer system
Answer:
4
Explanation:
Input/output, datapath, control, and memory
There wrong its C bold it.
:)))))
Write a C program to prform simple C aritlimetic calculations. The user is to enter a simple expression(integer operaior integer) such as 15+30=45. The program is to exlract the 2 operands and the operator, perform the indicated calculation and display the result. For examole15 + 30 = 45. Operators should includc t, -, * , l, and %'.Operands are prcsitive integers, no sign. Use getchar to input the cxpression. Allow for variable spacing before the first operand and between operators and operands.
Answer:
Here is the C program:
#include <stdio.h> //to use input output functions
//functions prototype
unsigned int mod(unsigned int a, unsigned int b);
unsigned int mul(unsigned int a, unsigned int b);
unsigned int sub( unsigned int a,unsigned int b);
float divide(unsigned int a,unsigned int b);
unsigned int add( unsigned int a,unsigned int b);
int main() { //start of main method
unsigned int a, b; //declare variables to store the operands
char d; //declare variable to store the operator
printf("Enter an operator: "); //prompts user to enter an operator
scanf("%c",&d); //reads the operator from use
getchar(); //gets a character
while (d!='q') { //keeps iterating until user enters q to quit
printf("Enter 1st operand: "); //prompts user to enter first operand
scanf("%d",&a); //reads first operand from user
getchar(); //reads character
printf("Enter 2nd operand: "); //prompts user to enter second operand
scanf("%d",&b); //reads second operand from user
getchar();
if (d=='%') { //if the character of operator is a mod
printf("%d",a); //prints operand 1
putchar(d); //displays operator
printf("%d",b); //displays operand 2
printf(" = "); //displays =
mod(a,b); } //displays computed modulo of two input operands
if (d=='*') //if the input character is for multiplication operator
{printf("%d",a); //prints operand 1
putchar(d); //displays operator
printf("%d",b); //displays operand 2
printf(" = "); //displays =
mul(a,b); } //displays computed multiplication
if (d=='+') { //if the input character is for addition operator
printf("%d",a); //prints operand 1
putchar(d); //displays operator
printf("%d",b); //displays operand 2
printf(" = "); // displays =
add(a,b); } //displays computed addition
if (d=='/') { //if the input character is for division operator
printf("%d",a); // prints operand 1
putchar(d); //displays operator
printf("%d",b); //displays operand 2
printf(" = "); //displays =
divide(a,b); } //displays computed division
if (d=='-') { //if the input character is for subtraction operator
printf("%d",a); //prints operand 1
putchar(d); //displays operator
printf("%d",b); // displays operand 2
printf(" = "); //displays =
sub(a,b); } //displays computed subtraction
printf("Enter an operator: "); //asks again to enter an operator
scanf("%c",&d); //reads operator from user
getchar(); } } //gets character
unsigned int mod( unsigned int a, unsigned int b){ //function to compute modulo of two integers with no sign
int c = a%b; //computes mod
printf("%d",c); } //displays mod result
unsigned int add(unsigned int a, unsigned int b){ // function to compute addition of two integers
int c = a+b; //computes addition
printf("%d\n",c); } //displays result of addition
unsigned int mul(unsigned int a, unsigned int b){ //function to compute multiplication of two integers
int c = a*b; //multiplies two integers
printf("%d\n",c); } //displays result of multiplication
float divide(unsigned int a, unsigned int b){ //function to compute division of two integers
float c = a/b; //divides two integers and stores result in floating point variable c
printf("%f\n",c); } //displays result of division
unsigned int sub(unsigned int a, unsigned int b){ //function to compute subtraction of two integers
int c = a-b; //subtracts two integers
printf("%d\n",c); } //displays result of subtraction
Explanation:
The program is well explained in the comments mentioned with each line of the program. The program uses while loop that keeps asking user to select an operator and two operands to perform arithmetic calculations. The if conditions are used to check what arithmetic calculation is to be performed based on user choice of operand and calls the relevant function to perform calculation. There are five functions that perform addition, modulo, subtraction, division and multiplication and display the result of computation. The screenshot of output is attached.
Complete the sentence.
You can buy new applications at a retail store on DVD for ____.
O laptops
O smartphones
O tablets
Answer:
laptops
Explanation:
B
You can buy new applications at a retail store on DVD for laptops. Thus, option A (laptops) is correct.
What is a DVD?A website is an accumulation of internet pages and related items that is posted on at least one server and given an unique domain name. Most blogs focus on a single subject or objective, such as reporting, education, industry, entertaining, or photo sharing.
A raster-based photograph designed for the web and publishing is stored as a JPG file. The JPG format is the default file format for image sensors and is the most widely used picture format on the web because of its universal compatibility and decompression. Portraits in both colour and black and white work brilliantly with them.
Therefore, option A (laptops) is the correct option.
Learn more about DVD, here:
https://brainly.com/question/13664390
#SPJ6
How can a LAN be changed into a WAN?
Answer:
I hope the above picture may help you.
what is a conditional format that displays a horizontal gradient or solid fill indicating the cell's relitive value compared to other selected cells
Answer:
Data bar
Explanation:
The answer to this question is data bar. Through the use of a day bar we are able to see trends in our data. They are very useful when it comes to visualization of values that are In a range of cells. Now if the bar is longer then the value we are visualizing is definitely higher. And if it is shorterr the value is lower. Several applications like excel has programmes that makes use of data bars especially for statistical purposes.
What is the missing line of code? >>> sentence = "Programming is fun!" 'gr O sentence[2:6] sentence[3:5] sentence[3:6] sentence[2:5]
Answer: not sentence [3:6]
I hope this helps
Explanation:
Which is an example of a function header in Python? left (40): def drawT(): left def
Answer:
B
Explanation:
Answer:
b def drawT():
Explanation:
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program:
Min miles: -10
Max miles: 40
Here's what I have so far:
import java.util.Scanner;
public class ArraysKeyValue {
public static void main (String [] args) {
final int NUM_ROWS = 2;
final int NUM_COLS = 2;
int [][] milesTracker = new int[NUM_ROWS][NUM_COLS];
int i = 0;
int j = 0;
int maxMiles = 0; // Assign with first element in milesTracker before loop
int minMiles = 0; // Assign with first element in milesTracker before loop
milesTracker[0][0] = -10;
milesTracker[0][1] = 20;
milesTracker[1][0] = 30;
milesTracker[1][1] = 40;
//edit from here
for(i = 0; i < NUM_ROWS; ++i){
for(j = 0; j < NUM_COLS; ++j){
if(milesTracker[i][j] > maxMiles){
maxMiles = milesTracker[i][j];
}
}
}
for(i = 0; i < NUM_ROWS; ++i){
for(j = 0; j < NUM_COLS; ++j){
if(milesTracker[i][j] < minMiles){
minMiles = milesTracker[i][j];
}
}
}
//edit to here
System.out.println("Min miles: " + minMiles);
System.out.println("Max miles: " + maxMiles);
}
Answer:
See Explanation
Explanation:
Your program is correct and doesn't need an attachment.
However, there's a mismatch in placement of curly braces in your program
{
}
I've made corrections to that and I've added the corrected program as an attachment.
Aside that, there's no other thing to be corrected in your program.
Use another compiler to compile your program is you are not getting the required output.
Which of the following domestic appliances does not use a magnet?
A. Fridge
B. Pressing iron
C. Radio
D. Fan
Select a cybersecurity career that interests you. Describe the job duties and identify the skills required to excel in that career. Then, make a career plan.
Answer:
it's business
Explanation:
business you started with small and work for it grow up.
what is the importance of human flourishing to science and technology?
Explanation:
:*):*):*)*)*:)*:)*:*)*:**:*)*:)*:)*:*):*)*P:)*:*):*)
:*
):*
)*:
)*:*
):*):*)*:*):*)*:*):*):*):)*:*):*):*):*)
:*):*)
Read the following code:
x = 1
while(x < 26)
print(x)
x = x + 1
There is an error in the while loop. What should be fixed?
1. Add a colon to the end of the statement
2. Begin the statement with the keyword count
3. Change the parentheses around the test condition to quotation marks
4. Use quotation marks around the relational operator
This is python code.
In python, you are supposed to put a colon at the end of while loops. This code does not have a colon after the while loop, therefore, you need to add a colon to the end of the statement.
The error to be fixed in the while loop is to add a colon at the end of the while statements.
x = 1
while (x<26)
print(x)
x = x + 1
This is the right code;
x = 1
while(x < 26):
print(x)
x = x + 1
The actual code , the while statement is missing a colon at the end of it.
The code is written in python. In python while or for loops statements always ends with a colon.
In the error code, there was no colon at the end of the while loop.
The right codes which I have written will print the value 1 to 25.
learn more on python loop here: https://brainly.com/question/19129298?referrer=searchResults
Which of the following behaviors is considered ethical?
copying another user’s password without permission
hacking software to test and improve its efficiency
using a limited access public computer to watch movies
deleting other user’s files from a public computer
Answer:
using a limited access public computer to watch movies
Explanation:
Cause it doesn't involve you performing any illegal actions.
Answer:
C. using a limited access public computer to watch movies
Explanation:
IM A DIFFERENT BREEED!!
PLUS NOTHING ELSE MAKES SENSE LOL!
In a system where Round Robin is used for CPU scheduling, the following is TRUE when a process cannot finish its computation during its current time quantum? The process will terminate itself. The process will be terminated by the operating system. The process's state will be changed from running to blocked. None of the mentioned.
Answer:
B. The process will be terminated by the operating system.
Explanation:
When Round Robin is used for CPU scheduling, a time scheduler which is a component of the operating system is used in regulating the operation. A time limit is set for each of the processes to be run.
So, when a process fails to complete running before its time elapses, the time scheduler would log it off and return it to the queue. This queue is in a circular form and gives each of the processes a chance to run its course.
Based on the information given regarding CPU scheduling, the correct option is C. The process's state will be changed from running to blocked.
It should be noted that in a system where Round Robin is used for CPU scheduling, when a process cannot finish its computation during its current time quantum, the process's state will be changed from running to blocked.
It should be noted that a prices transition to a blocked state occurs when it's waiting for some events like a particular resource becoming available.
Learn more about CPU scheduling on:
https://brainly.com/question/19999569
Which of the following tabs in the PowerPoint Ribbon is unique to PowerPoint,
not found in other Microsoft Office applications?
a.
b.
Home
Animations
Insert
View
Answer:
The answer to this question is given below in the explanation section
Explanation:
The correct option for this question is Animation tab.
Animation tab in PowerPoint ribbon is a unique tab that is not found in other office applications such as in word, excel, outlook, publisher etc.
Because in PowerPoint you can use animation to make your slides animated and all animation can be managed and animation-related settings, you can find in the animation tab.
However, other tabs such as Home, Insert, and View are common in all office applications.
Walter The Dog is hot
(This was a waste of 37 points lol)
Answer:
no
Explanation:
mabey yes
The Beaufort Wind Scale is used to characterize the strength of winds. The scale uses integer values and goes from a force of 0, which is no wind, up to 12, which is a hurricane. The following script first generates a random force value. Then, it prints a message regarding what type of wind that force represents, using a switch statement. If random number generated is 0, then print "there is no wind", if 1 to 6 then print "this is a breeze", if 7 to 9 "this is a gale", if 10 to 11 print "this is a storm", if 12 print "this is a hurricane!". (Hint: use range or multiple values in case statements like case {1,2,3,4,5,6})
Required:
Re-write this switch statement as one nested if-else statement that accomplishes exactly the same thing. You may use else and/or elseif clauses.
ranforce = randi([0, 12]);
switch ranforce
case 0
disp('There is no wind')
case {1,2,3,4,5,6}
disp('There is a breeze')
case {7,8,9}
disp('This is a gale')
case {10,11}
disp('It is a storm')
case 12
disp('Hello, Hurricane!')
end
Answer:
The equivalent if statements is:
ranforce = randi([0, 12]);
if (ranforce == 0)
disp('There is no wind')
else if(ranforce>0 && ranforce <7)
disp('There is a breeze')
else if(ranforce>6 && ranforce <10)
disp('This is a gale')
else if(ranforce>9 && ranforce <12)
disp('It is a storm')
else if(ranforce==12)
disp('Hello, Hurricane!')
end
Explanation:
The solution is straight forward.
All you need to do is to replace the case statements with corresponding if or else if statements as shown in the answer section
The fraction 460/7 is closest to which of the following whole numbers?
Remove gray from RGB Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray). Given values for red, green, and blue, remove the gray part.
Answer:
Here is the C++ program:
#include <iostream> //to use input output functions
using namespace std; //to identify objects cin cout
int main() { //start of main method
int red,green,blue,smallest; //declare variables to store integer values of red,green, blue and to store the smallest value
cout<<"Enter value for red: "; //prompts user to enter value for red
cin>>red; //reads value for red from user
cout<<"Enter value for green: "; //prompts user to enter value for green
cin>>green; //reads value for green from user
cout<<"Enter value for blue: "; //prompts user to enter value for blue
cin>>blue; //reads value for blue from user
//computes the smallest value
if(red<green && red<blue) //if red value is less than green and blue values
smallest=red; //red is the smallest so assign value of red to smallest
else if(green<blue) //if green value is less than blue value
smallest=green; //green is the smallest so assign value of green to smallest
else //this means blue is the smallest
smallest=blue; //assign value of blue to smallest
//removes gray part by subtracting smallest from rgb
red=red-smallest; //subtract smallest from red
green=green-smallest; //subtract smallest from green
blue=blue-smallest; //subtract smallest from blue
cout<<"red after removing gray part: "<<red<<endl; //displays amount of red after removing gray
cout<<"green after removing gray part: "<<green<<endl; //displays amount of green after removing gray
cout<<"blue after removing gray part: "<<blue<<endl; } //displays amount of blue after removing gray
Explanation:
I will explain the program using an example.
Lets say user enter 130 as value for red, 50 for green and 130 for blue. So
red = 130
green = 50
blue = 130
First if condition if(red<green && red<blue) checks if value of red is less than green and blue. Since red=130 so this condition evaluate to false and the program moves to the else if part else if(green<blue) which checks if green is less than blue. This condition evaluates to true as green=50 and blue = 130 so green is less than blue. Hence the body of this else if executes which has the statement: smallest=green; so the smallest it set to green value.
smallest = 50
Now the statement: red=red-smallest; becomes:
red = 130 - 50
red = 80
the statement: green=green-smallest; becomes:
green = 50 - 50
green = 0
the statement: blue=blue-smallest; becomes:
blue = 130 - 50
blue = 80
So the output of the entire program is:
red after removing gray part: 80 green after removing gray part: 0 blue after removing gray part: 80
The screenshot of the program along with its output is attached.
What is the maximum number of VLANs that can be configured on a switch supporting the 802.1Q protocol? Why?
Answer:
4096 VLANs
Explanation:
A VLAN (virtual LAN) is a group of devices on one or more LAN connected to each other without physical connections. VLANs help reduce collisions.
An 802.1Q Ethernet frame header has VLAN ID of 12 bit VLAN field. Hence the maximum number of possible VLAN ID is 4096 (2¹²). This means that a switch supporting the 802.1Q protocol can have a maximum of 4096 VLANs
A lot of VLANs ID are supported by a switch. The maximum number of VLANs that can be configured on a switch supporting the 802.1Q protocol is 4,094 VLANS.
All the VLAN needs an ID that is given by the VID field as stated in the IEEE 802.1Q specification. The VID field is known to be of 12 bits giving a total of 4,096 combinations.But that of 0x000 and 0xFFF are set apart. This therefore makes or leaves it as 4,094 possible VLANS limits. Under IEEE 802.1Q, the maximum number of VLANs that is found on an Ethernet network is 4,094.
Learn more about VLANs from
https://brainly.com/question/25867685