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
IrinaK [193]
3 years ago
11

Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all th

e non-negative values into total. The loop terminates when a value less than 0 is read into amount. Don't forget to initialize total to 0.
Computers and Technology
1 answer:
Whitepunk [10]3 years ago
8 0

Answer:

Following are the statement in C++ Language is given below

total=0; // variable declaration

cin >> amount; // Read the input

while(amount >=0) //iterating the loop

{

if(amount>0) // checking condition

total=total+amount; // perform operation

}

Explanation:

Following is the description of the statement

  • Declared a variable "total" and initialized with them 0 to them.
  • Read the input in the "amount" variable by using cin.
  • iterating the loop when the amount is greater then 0.
  • Checking the condition if(amount>0) then adding the total variable and amount and storing them into the total variable.

You might be interested in
Select the correct answer.
Vladimir79 [104]

Answer:

I think make a copy maybe

Explanation:

4 0
3 years ago
Read 2 more answers
Develop a C program that calculates the final score and the average score for a student from his/her (1)class participation, (2)
Ghella [55]

Answer:

#include <iomanip>

#include<iostream>

using namespace std;

int main(){

char name[100];

float classp, test, assgn, exam, prctscore,ave;

cout<<"Student Name: ";

cin.getline(name,100);

cout<<"Class Participation: "; cin>>classp;

while(classp <0 || classp > 100){  cout<<"Class Participation: "; cin>>classp; }

cout<<"Test: "; cin>>test;

while(test <0 || test > 100){  cout<<"Test: "; cin>>test; }

cout<<"Assignment: "; cin>>assgn;

while(assgn <0 || assgn > 100){  cout<<"Assignment: "; cin>>assgn; }

cout<<"Examination: "; cin>>exam;

while(exam <0 || exam > 100){  cout<<"Examination: "; cin>>exam; }

cout<<"Practice Score: "; cin>>prctscore;

while(prctscore <0 || prctscore > 100){  cout<<"Practice Score: "; cin>>prctscore; }

ave = (int)(classp + test + assgn + exam + prctscore)/5;

cout <<setprecision(1)<<fixed<<"The average score is "<<ave;  

return 0;}

Explanation:

The required parameters such as cin, cout, etc. implies that the program is to be written in C++ (not C).

So, I answered the program using C++.

Line by line explanation is as follows;

This declares name as character of maximum size of 100 characters

char name[100];

This declares the grading items as float

float classp, test, assgn, exam, prctscore,ave;

This prompts the user for student name

cout<<"Student Name: ";

This gets the student name using getline

cin.getline(name,100);

This prompts the user for class participation. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Class Participation: "; cin>>classp; </em>

<em> while(classp <0 || classp > 100){  cout<<"Class Participation: "; cin>>classp; } </em>

This prompts the user for test. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Test: "; cin>>test; </em>

<em> while(test <0 || test > 100){  cout<<"Test: "; cin>>test; } </em>

This prompts the user for assignment. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Assignment: "; cin>>assgn; </em>

<em> while(assgn <0 || assgn > 100){  cout<<"Assignment: "; cin>>assgn; } </em>

This prompts the user for examination. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Examination: "; cin>>exam; </em>

<em> while(exam <0 || exam > 100){  cout<<"Examination: "; cin>>exam; } </em>

This prompts the user for practice score. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Practice Score: "; cin>>prctscore; </em>

<em> while(prctscore <0 || prctscore > 100){  cout<<"Practice Score: "; cin>>prctscore; } </em>

This calculates the average of the grading items

ave = (int)(classp + test + assgn + exam + prctscore)/5;

This prints the calculated average

cout <<setprecision(1)<<fixed<<"The average score is "<<ave;  

8 0
3 years ago
The stub: transmits the message to the server where the server side stub receives the message and invokes procedure on the serve
elena55 [62]

Answer:

It does all of these

Explanation:

The stub is able to do all of what we have in this question. It can locate computer connections, locate ports on a computer, transit message to server etc.

in distributed computing, a stub is a piece of code that does the work of converting parameters that are passed between the client and the server at a time of remote procedure call.

The main objective of an RPC is to allow the client to call procedures remotely on another server.

3 0
2 years ago
____ contain instructions for the OS for hardware devices, such as the keyboard, mouse, and video card, and are stored in the sy
AnnyKZ [126]

The Motherboard contains instructions for the OS for hardware devices, such as the keyboard, mouse, and video card, and are stored in the systemroot\Windows\System32\Drivers folder.

Learned this in middle school, your welcome ;)

3 0
3 years ago
If you create an object using Java’s BigDecimal class, and then perform a division that results in a non-terminating decimal div
azamat

Answer:

Arithmetic Exception is the correct answer to the following blank.

Explanation:

Because the BigDecimal class is the class of the Java Programming Language that deal with the double data type numbers for the arithmetic expressions and also for the format conversions and it is the math type class of the Java Programming language which is used in arithmetic operations. So, that's why the following answer is not wrong.

3 0
3 years ago
Other questions:
  • Wich of these is an example of magnetic storage
    11·1 answer
  • Which of the following would most likely be responsible for configuring firewalls and IDPSs, implementing security software, and
    8·2 answers
  • What is an online reputation?
    12·2 answers
  • Engineers and scientists redesign a prototype if it does not work correctly true or false and why
    10·2 answers
  • Name three types of hard drives, along with its speed and size.
    8·1 answer
  • How do you close a file?
    12·2 answers
  • Persuasion is when Someone speaks to crowd about love <br>○True<br>○False​
    10·1 answer
  • What happens when you apply a theme to a form?
    14·1 answer
  • Create a file using any word processing program or text editor. Write an application that displays the files, name, containing f
    8·1 answer
  • Which operation is not efficiently supported by heaps?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!