1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vlad [161]
3 years ago
6

Connect 5 LEDs with any random colors. Iteratively, turn ON 1 to 5 LED(s) that will take 5 iterations in total, and in every ite

ration ask the user "How many LEDs are ON?". At the end of the completion of all iterations, display in the output "Correct answers: a%". For example, if a user’s answers are correct to none of the 5 questions, then display "Correct answers: 0%"; If a user’s answers are correct to 1 question, then display "Correct answers: 20%"; If a user’s answers are correct to 2 questions, then display "Correct answers: 40%"; and so on.

Computers and Technology
1 answer:
vlabodo [156]3 years ago
7 0

Answer:

See explaination for program code.

Explanation:

C++ programming language is a powerful general-purpose programming language. It can be used to develop operating systems, browsers, games, and so on.

C++ supports different ways of programming like procedural, object-oriented, functional, and so on. This makes C++ powerful as well as flexible.

Please kindly refer to attachment for a C++ programming code that performs the operation.

You might be interested in
What are impacts of ict in every day your life?describe if prifely​
telo118 [61]

Answer:

ICT is a broad subject and a concept of evolving.It covers any product that will store, retrieve, manipulate, transmit, or receive information electronically in a digital form.

Explanation:

HOW WE USE ICT IN OUR DAILY LIFE

COMMUNICATION

JOB OPPORTUNITIES

EDUCATION

SOCIALIZING

POSITIVE IMPACT OF ICT IN OUR DAILY LIFE

1.Easy to access information:

I use ICT to access more information that I need for everyday schooling.Because Internet has more faster than searching to a school library. Even the deadline of my research is coming, I can make it fast with the help of ICT

2. Education: distance learning and on-line tutorials. New ways of learning, e.g. interactive multi-media and virtual reality.

3.Free access of sharing like photo,video,and message

5 0
2 years ago
How does a machine learning model is deployed
yan [13]

Answer:

Explanation:

Deployment is the method by which you integrate a machine learning model into an existing production environment to make practical business decisions based on data. It is one of the last stages in the machine learning life cycle and can be one of the most cumbersome.

7 0
3 years ago
Question 4(10pt): sum of the max value found in each row Write a function maxSum that takes two parameters; a 2D integer array w
mario62 [17]

Answer:

Following is the program in c++ language  

#include <iostream> // header file

using namespace std; // namespace

int maxSum(int ar[][10],int r) // function definition of  maxsum

{

  int s=0; // varaible declaration

  for(int k=0;k<r;k++)// iterating the loop

  {

      int maximum=ar[k][0]; //finding the maximum value

      for(int k2=0;k2<10;k2++)// iterating the loop

      {

          if(maximum<ar[k][k2]) // check the condition

          {

            maximum=ar[k][k2];   // storing the value in the maximum variable

          }

           }

       s=s+maximum;//adding maximum value to the sum

  }

  return s; // return the sum

}

int main() // main function

{

  int ar[][10]={{5,2,8,-8,9,9,8,-5,-1,-5},{4,1,8,0,10,7,6,1,8,-5}}; // initilaized array

  cout<<"sum of maximum value:";

  int t=maxSum(ar,2); // function calling

  cout<<t; // display the maximum value

}

Output:

sum of maximum value:19

Explanation:

Following are the description of Program  

  • The main method declared and initialized an array ar with the column value 10.
  • After that call the method maxsum .The control will move to the function definition of maxsum.
  • In the function header of maxisum there are two value i.e array "ar" and "r".
  • In this function definition, we adding the maximum value to the sum and return the variable "s".
  • In the main function, we print the value.
5 0
3 years ago
C++ code only
nordsb [41]

Using the computational language C++ it is possible to write a code is possible to create a function that stores items like this:

<h3>Writting the code in C++: </h3>

<em>//Header files</em>

<em>#include <iostream></em>

<em>#include <string></em>

<em>#include <fstream></em>

<em>using namespace std;</em>

<em>//Class inventoryItem</em>

<em>class inventoryItem</em>

<em>{</em>

<em>public:</em>

<em>//Variable declaration</em>

<em>string itemName;</em>

<em>string itemNumber;</em>

<em>double itemPrice;</em>

<em>int itemQuantity;</em>

<em>};</em>

<em>//implementation of menuItems() function.</em>

<em>void menuItems()</em>

<em>{</em>

<em>// Display the Menu</em>

<em>cout << "=============================\n";</em>

<em>cout << " 1) Add an item to memory\n"</em>

<em><< " 2) Search memory for an item \n"</em>

<em><< " 3) List what's in memory\n"</em>

<em><< " 4) Total value on hand\n"</em>

<em><< " 5) Save to a file\n"</em>

<em><< " 6) Read from a file\n"</em>

<em><< " 0) Exit Program" << endl;</em>

<em>}</em>

<em>//main method.</em>

<em>int main()</em>

<em>{</em>

<em>//variable declaration.</em>

<em>int mnuChoice, cn = 0, d;</em>

<em>string n;</em>

<em>double sum = 0, c;</em>

<em>int temp;</em>

<em>string a, b;</em>

<em>string inputBuffer;</em>

<em>inventoryItem items[100];</em>

<em>ifstream inventoryFile("inventory.txt");</em>

<em>if (inventoryFile)</em>

<em>{</em>

<em>//store the data from the file to memory.</em>

<em>while (!(inventoryFile.eof()))</em>

<em>{</em>

<em>inventoryFile >> items[cn].itemName;</em>

<em>inventoryFile >> items[cn].itemNumber;</em>

<em>inventoryFile >> inputBuffer;</em>

<em>items[cn].itemPrice = atof(inputBuffer.c_str());</em>

<em>inventoryFile >> inputBuffer;</em>

<em>items[cn].itemQuantity = atoi(inputBuffer.c_str());</em>

<em>cn++;</em>

<em>}</em>

<em>inventoryFile.close();</em>

<em>ifstream inventoryFile("inventory.txt");</em>

<em>ofstream fout;</em>

<em>fout.open("inventory.txt");</em>

<em>do</em>

<em>{</em>

<em>menuItems();</em>

<em>cout << cn << " items stored." << endl;</em>

<em>// Prompt and read choice form the user</em>

<em>cout << "Enter your choice: ";</em>

<em>cin >> mnuChoice;</em>

<em />

<em>switch (mnuChoice)</em>

<em>{</em>

<em>//Add a new inventory item to the data in memory.</em>

<em>case 1:</em>

<em>// Prompt and read name of the item from the user</em>

<em>cout << "Enter name of the item: ";</em>

<em>cin >> inputBuffer;</em>

<em>items[cn].itemName = inputBuffer;</em>

<em>// Prompt and read itemNumber from the user</em>

<em>cout << "Enter the itemNumber: ";</em>

<em>cin >> inputBuffer;</em>

<em>items[cn].itemNumber = inputBuffer;</em>

<em>// Prompt and read itemPrice from the user</em>

<em>cout << "Enter the itemPrice: ";</em>

<em>cin >> inputBuffer;</em>

<em>items[cn].itemPrice = atof(inputBuffer.c_str());</em>

<em>// Prompt and read itemQuantity from the user</em>

<em>cout << "Enter the itemQuantity: ";</em>

<em>cin >> inputBuffer;</em>

<em>items[cn].itemQuantity = atoi(inputBuffer.c_str());</em>

<em>cn++;</em>

<em>break;</em>

<em>//Search the inventory for an item by inventory number.</em>

<em>case 2:</em>

<em>temp = 0;</em>

<em>cout << "Enter inventory itemNumber: ";</em>

<em>cin >> n;</em>

<em>for (int i = 0; i < cn&&temp != 1; i++)</em>

<em>{</em>

<em>// If found, print the stored info</em>

<em>if (items[i].itemNumber.compare(n) == 0)</em>

<em>{</em>

<em>// Display the stored information</em>

<em>cout << "Item Name" << "\t" << "Item Number" << "\t" << " Item Price" << "\t" << " Item Quantity" << endl;</em>

<em>cout << items[i].itemName << "\t " << items[i].itemNumber << " \t" << items[i].itemPrice << "\t " << items[i].itemQuantity << endl;</em>

<em>temp = 1;</em>

<em>}</em>

<em>}</em>

<em>// otherwise print 'not found'.</em>

<em>if (temp == 0)</em>

<em>{</em>

<em>cout << "Not found!!!" << endl;</em>

<em>}</em>

<em>break;</em>

<em>//List the inventory on the screen</em>

<em>case 3:</em>

<em>cout << "The data in the memory is:" << endl;</em>

<em>cout << "Item Name" << "\t" << "Item Number" << "\t" << " Item Price" << "\t" << " Item Quantity" << endl;</em>

<em>for (int i = 0; i < cn; i++)</em>

<em>{</em>

<em>cout << items[i].itemName << "\t " << items[i].itemNumber << "\t " << items[i].itemPrice << " \t" << items[i].itemQuantity << endl;</em>

<em>}</em>

<em>break;</em>

<em>// Calculate the total value on hand.</em>

<em>case 4:</em>

<em>for (int i = 0; i < cn; i++)</em>

<em>{</em>

<em>// The sum is the accumulation of all the (quantities * prices).</em>

<em>sum += items[i].itemPrice*items[i].itemQuantity;</em>

<em>}</em>

<em>cout << "sum value on hand: " << sum << endl;</em>

<em>break;</em>

<em>// Save the inventory data in the given file</em>

<em>case 5:</em>

<em>for (int i = 0; i < cn; i++)</em>

<em>{</em>

<em>if (i == cn - 1)</em>

<em>{</em>

<em />

<em>fout << items[i].itemName << " \t" << items[i].itemNumber << " \t" << items[i].itemPrice << " \t" << items[i].itemQuantity;</em>

<em>}</em>

<em>else</em>

<em>{</em>

<em />

<em>fout << items[i].itemName << " \t" << items[i].itemNumber << " \t" << items[i].itemPrice << " \t" << items[i].itemQuantity << endl;</em>

<em>}</em>

<em>}</em>

<em>break;</em>

<em>// Read the data from the file</em>

<em>case 6:</em>

<em>while (!(inventoryFile.eof()))</em>

<em>{</em>

<em>inventoryFile >> a;</em>

<em>inventoryFile >> b;</em>

<em>inventoryFile >> inputBuffer;</em>

<em>c = atof(inputBuffer.c_str());</em>

<em>inventoryFile >> inputBuffer;</em>

<em>d = atoi(inputBuffer.c_str());</em>

<em>// Dsiplays the data in the file</em>

<em />

<em>cout << a << " " << b << " " << c << " " << d << endl;</em>

<em>}</em>

<em>break;</em>

<em>}</em>

<em>// Check the menu choice is not equal to 0,</em>

<em>//if it is equal exit from the loop</em>

<em>} while (mnuChoice != 0);</em>

<em>// File closed</em>

<em>fout.close();</em>

<em>inventoryFile.close();</em>

<em>}</em>

<em>// If the inventory file does not exist</em>

<em>// and then display the error message.</em>

<em>else</em>

<em>{</em>

<em>cout << "File does not exist!" << endl;</em>

<em>}</em>

<em />

<em>return 0;</em>

<em>}</em>

See more about C++ code at brainly.com/question/17544466

#SPJ1

5 0
1 year ago
Write a python program to calculate the compound interest
Lemur [1.5K]

Answer:

initialPrincipal = float(input("Please enter your initial principal:"))

interestRate = float(input("Please enter your interest rate:"))

timePeriod = float(input("Please enter your number of times interest applied per time period:"))

elapsedPeriod = float(input("Please enter your number of time period elapsed:"))

finalAmount = initialPrincipal*(1 + interestRate/timePeriod)^(timePeriod*elapsedPeriod)

print("Your final amount would be:", finalAmount)

4 0
2 years ago
Other questions:
  • after placing her insertion point after grandma's kitchen, order the steps Danica needs to follow to insert and format the regis
    12·2 answers
  • To maintain your body temperature, your body converts chemical potential energy into thermal energy T or F
    6·1 answer
  • Who created fortnite
    15·2 answers
  • Please choose odd one out please tell fast ​
    13·2 answers
  • Which statement about intellectual property is true? (CSI-7.6) Group of answer choices It is okay to use code you find on the in
    14·1 answer
  • For python how do I ask the user how many numbers they want to enter and then at the ending add those numbers up together?
    10·1 answer
  • Consider the steps for debugging. First, you should
    12·1 answer
  • When a support agent does not know the answer to a question, a good incident management strategy is to tell the user ____.
    5·1 answer
  • True or false FAFSA awards work study, but jobspeaker can be used to learn which jobs are available
    12·1 answer
  • The internet is ________. an internal communication system for businesses a large network of networks a communication system for
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!