answer.
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
harkovskaia [24]
2 years ago
6

This program finds the sum and average of three numbers. What are the proper codes for Lines a and b?

Computers and Technology
2 answers:
o-na [289]2 years ago
8 0

Answer:

The codes in line A and line B are given below:

average=sum divided by 3

Explanation:

Gennadij [26K]2 years ago
4 0

Answer:

The Proper codes in Line a and Line b is given below

average=Sum/3  

print (" Average is = ", average)

Explanation:

In the given question it calculated the sum but the program does not calculate the average of the 3 numbers.The average of the 3 number is calculated by using average=Sum/3   statement so we add this code in Line a then After that print the value of average by using the print function so we add this code in Line b.

You might be interested in
Which of the following has been a result of the increase in local organic farms?a decrease in farmers' markets
Alexxx [7]

Answer:

I think it's D or B, but most likely D

6 0
2 years ago
Read 2 more answers
Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to beco
harina [27]

Answer:

One of the strategies to avoid nested conditional is to use logical expressions such as the use of AND & operator.

One strategy is to use an  interface class with a method. That method can be created to be used for a common functionality or purpose. This is also called strategy design pattern. You can move the chunk of conditional statement to that method. Then each class can implement that interface class and use that shared method according to their own required task by creating objects of sub classes and call that common method for any such object. This is called polymorphism.

Explanation:

Nested conditionals refers to the use of if or else if statement inside another if or else if statement or you can simply say a condition inside another condition. For example:

if( condition1) {  

//executes when condition1 evaluates to true

 if(condition2) {

//executes when condition1  and condition2 evaluate to true

 }  else if(condition3) {

 //when condition1 is true and condition3 is true

} else {

 //condition1  is true but neither condition2 nor conditions3 are true

}  }

The deeply nested conditionals make the program difficult to understand or read if the nested conditionals are not indented properly. Also the debugging gets difficult when the program has a lot of nested conditionals.

So in order to avoid nested conditionals some strategies are used such as using a switch statement.

Here i will give an example of one of the strategies i have mentioned in the answer.

Using Logical Expressions:

A strategy to avoid nested conditionals is to use logical expressions with logical operators such as AND operator. The above described example of nested conditionals can be written as:

if(condition1 && condition2){  //this executes only when both condition1 and condition2 are true

} else if(condition1 && condition3) {

this executes only when both condition1 and condition3 are true

} else if(condition1 ){

//condition1  is true but neither condtion2 nor condtion3 are true  }

This can further be modified to one conditional as:

if(!condition3){

// when  condition1 and condition2 are true

}

else

// condition3 is true

Now lets take a simple example of deciding to go to school or not based on some conditions.

if (temperature< 40){

  if (busArrived=="yes")   {

      if (!sick)       {

          if (homework=="done")           {

              printf("Go to school.");

          }

      }     

  }

}

This uses nested conditionals. This can be changed to a single conditional using AND logical operator.

if ((temperature <40) && (busArrived=="yes") &&

(!sick) && (homework=="done"))

{    cout<<"Go to school."; }

6 0
2 years ago
A drive is small enough to be carried in one's pocket.
hjlf

Answer: Pen

Explanation:

4 0
1 year ago
If a class has member variables that are pointers, you must ensure that you implement ____.
DedPeter [7]

Answer:

objects

Explanation:

pointer are used for the objects

5 0
2 years ago
Write code that determines the number of full days represented by the number of hours stored in the variable hours and stores th
taurus [48]

Answer:

hours = 50

full_days = int(hours / 24)

print("The number of full days in " + str(hours) + " hours is " + str(full_days))

Explanation:

Initialize the hours

Since there are 24 hours in a full day, divide the hours by 24. Note that you need to typecast it to the int, because the result is a decimal value by default

Print the values as requested

4 0
2 years ago
Other questions:
  • What helps companies and organizations to target masses of people, provide 24/7 services, and deliver better marketing in a chea
    13·2 answers
  • Rob creates a Course_Details table that has four columns: Course _ID, Course_Name, Semester and Credits. A course may have 0.5 c
    6·2 answers
  • The alternative to encapsulating security protocol (esp) is _________.
    10·1 answer
  • Julie is working on a spreadsheet with data about the company's profits. They will be sharing this data with customers. She chec
    6·2 answers
  • If byte stuffing is used to transmit Data, what is the byte sequence of the frame (including framing characters)? Format answer
    6·1 answer
  • python Write a function that computes a future investment value at a given interest rate for a specified number of years. The fu
    11·1 answer
  • Chris accidentally steps on another student’s foot in the hallway. He apologizes, but the other student does not want to hear it
    13·2 answers
  • Exercise 4: Bring in program grades.cpp and grades.txt from the Lab 10 folder. Fill in the code in bold so that the data is prop
    12·1 answer
  • Nstructions
    7·1 answer
  • 1.21 LAB: Divide by x
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!