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
faust18 [17]
2 years ago
11

Assuming that the list newAnimals is initially empty, what would this list contain after the following code segment is run?

Computers and Technology
2 answers:
Bond [772]2 years ago
8 0
Answer is B. Beaver, cat, snake
allochka39001 [22]2 years ago
4 0

Answer:

b

Explanation:

You might be interested in
A shipping company uses the following function to calculate the cost in dollars of shipping based on the weight of the package (
Gwar [14]

Answer:

I am writing the code in JAVA and C++. Let me know if you want the code in some other programming language. Both the programs works the same but the only difference is that i have used logical operator AND (&&) with C++ code to check each condition.

JAVA code:

import java.util.Scanner;    // to take input from the user

public class ShippingCost {  // ShippingCost class

public static void main(String[] args) {   // main method entry to the program

Scanner input = new Scanner(System.in);  //allows to take input from user

System.out.print("please enter the weight of the package: "); /*prompts the user to enter the weight of package.*/

double weight = input.nextDouble();  /*reads and stores the input values(weight) entered by the user*/

       double cost=0;  //holds the value of cost

 if (weight<=0)  /* checks if the user enters weight value less than or equals to 0 */

 { System.out.println("invalid input."); //prints invalid input

     System.exit(0); //exits the program

 }

    else if (weight > 0 && weight <= 1)  /*if weight is greater than 0 and less than or equal to 1*/

   cost = 3.5;  /*if the above condition is true then it stores the value 3.5 in cost variable */

 else if (weight <= 3)  // if value of weight is less than or equal to 3

   cost = 5.5;  /*if the above condition is true then it stores the value 5.5 in cost variable */

 else if (weight <= 10)  // if value of weight is less than or equal to 10

   cost = 8.5;  /*if the above condition is true then it stores the value 8.5 in cost variable */

 else if (weight <= 20)  // if value of weight is less than or equal to 20

   cost = 10.5;/*if the above condition is true then it stores the value 10.5 in cost variable */

 else  // if the value of weight is greater than 20

 {  System.out.println("The package cannot be shipped");

// displays package cannot be shipped

      System.exit(0);  //exits the program if weight>20}

 System.out.println("The shipping cost is: $" + cost);     /*prints the value stored in the cost from any of the above conditions */

} }

C++ Code

#include <iostream>//to use input output functions

using namespace std;

int main() // start of main() function body

{ double weight; //stores weight value

   double cost= 0; //stores cost value

cout << "please enter the weight of the package:" << endl;

//prompts user to enter the weight

cin >> weight;    

//reads the value of weight entered by the user

  if (weight<=0) //if value of weight entered by user is less than or equal to 0

 { cout<<"invalid input."; //displays invalid input

     exit(0); //exits the program

 }

/*the below else if conditions are checked, if any one of them is true then the cost displayed in the output will be the which is assigned to cost variable of that specific if condition's body which evaluates to true. */

    else if (weight > 0 && weight <= 1)

   cost = 3.5;

 else if (weight > 1 && weight <=3)

   cost = 5.5;

 else if (weight > 3 && weight <= 10)

   cost = 8.5;

 else if (weight> 10 && weight <= 20)

   cost = 10.5;

 else //if weight>20

//displays the message below and exits the program

 {  cout<<"The package can not be shipped";

      exit(0); }

 cout<<"The shipping cost is: $"<<cost;  /*displays the value stored in cost variable of that else-if condition which evaluates to true */

}

Explanation:

Everything is well explained in the comments above. I will summarize it all.

The program takes the input weight from the user and checks the value of weight.

If and else-if conditions are used to check the value of weight.

if the value of weight is less than 0 or equal to 0 then invalid input is displayed.

Else the weight value is checked for the given ranges. && operator is used in each else if statement which is used to specify the range of the weight values the input weight should be in order to display the shipping cost.

For example take this statement: else if (weight > 0 && weight <= 1)

This statement checks the value entered by the user that if it lies in the range mentioned in this statement which is that the weight value should be greater than 0 AND less than or equal to 1. The value cannot lie above or below the given range in order for this condition to be true so && operator is used here.

If the weight entered by user exceeds 20 then the message is displayed:The package can not be shipped and the program exits. In JAVA System.exit(0) and in c++ exit(0) function is used to exit the program.

The output of both the programs is as following:

please enter the weight of the package: 3

The shipping cost is: $ 5.5

8 0
1 year ago
Why are smartphones and tablets capable of handling rich content and interactivity?
NikAS [45]

Answer:

Explanation:

With the advance in technology, smartphones, and tablets are built to meet the ever-increasing needs of users.

Smartphones are mobile phones that also have internet connectivity, they can be used to make calls and perform many tasks just like the conventional desktop. Smartphones and tablets are indeed considered computers because they also process inputs in form of commands and they produce outputs.

Smartphones and tablets are capable of handling rich content and interactivity because:

1. Wireless synchronization with other devices: Just like desktops, laptops, they can interact with other devices, and can receive and also send information doesn't matter the distance.

2. They have Internet connectivity.

3. They have strong hardware, good storage capacity.

4. They have inbuilt software and are capable of accepting other software and programs.

5. They are built with an appealing user interface.

6. Just as computers have processors, smartphones and tablets also have processors to ensure their speed at processing informations.

3 0
2 years ago
Which of the following code is correct? I: print("Programming is fun") print("Python") print("Computer Science") II: print("Prog
vfiekz [6]

Answer:

None of the options is correct.

Explanation:

One of the simplest statements that you can write in Python is a print statement, which causes a message to be displayed on the screen. For example, the following statement causes the message Python programming is fun! to be displayed:

print 'Python programming is fun!'

Notice that after the word print, the Python programming is fun! was written inside a set of single-quote marks. The quote marks are necessary, but they will not be displayed. They simply mark the beginning and the end of the text that we wish to display.

Here is an example of how you would type this print statement at the interpreter’s

prompt:

>>> print 'Python programming is fun!'

After typing the statement you press the Enter key and the Python interpreter executes the statement, as shown here:

>>> print 'Python programming is fun!'

Python programming is fun!

>>>

Thus, the correct way to write the codes in the question is:

print 'Programming is fun'

print 'Python'

print 'Computer Science'

3 0
2 years ago
Write a program to declare a matrix A[][] of order (MXN) where ‘M’ is the number of rows and ‘N’ is the
Liula [17]

Answer:

import java.io.*;

import java.util.Arrays;

class Main {

   public static void main(String args[])

   throws IOException{

       // Set up keyboard input

       InputStreamReader in = new InputStreamReader(System.in);

       BufferedReader br = new BufferedReader(in);

 

       // Prompt for dimensions MxN of the matrix

       System.out.print("M = ");

       int m = Integer.parseInt(br.readLine());

       System.out.print("N = ");

       int n = Integer.parseInt(br.readLine());

       // Check if input is within bounds, exit if not

       if(m <= 2 || m >= 10 || n <= 2 || n >= 10){

           System.out.println("Matrix size out of range.");

           return;

       }

       // Declare the matrix as two-dimensional int array

       int a[][] = new int[m][n];

 

       // Prompt for values of the matrix elements

       System.out.println("Enter elements of matrix:");

       for(int i = 0; i < m; i++){

           for(int j = 0; j < n; j++){

               a[i][j] = Integer.parseInt(br.readLine());

           }

       }

       // Output the original matrix

       System.out.println("Original Matrix:");

       printMatrix(a);

       // Sort each row

       for(int i = 0; i < m; i++){

         Arrays.sort(a[i]);

       }

       // Print sorted matrix

       System.out.println("Matrix after sorting rows:");

       printMatrix(a);

   }

   // Print the matrix elements separated by tabs

   public static void printMatrix(int[][] a) {

       for(int i = 0; i < a.length; i++){

           for(int j = 0; j < a[i].length; j++)

               System.out.print(a[i][j] + "\t");

           System.out.println();

       }

   }

}

Explanation:

I fixed the mistake in the original code and put comments in to describe each section. The mistake was that the entire matrix was sorted, while only the individual rows needed to be sorted. This even simplifies the program. I also factored out a printMatrix() method because it is used twice.

4 0
1 year ago
The Vice President (VP) of Customer Support for Universal Containers has issued a mission statement that "We will empower our cu
elena-14-01-66 [18.8K]

Answer: The three most appropriate options are:

options C, D E

Explanation:

(1) Enabling customers to be emailed FAQs by accessing the interactive voice response 24 hours a day helps consultant achieve mission statement.

(2) Also, mobile devices should have the same support as desktops for mobile devices customer community and should be well optimized.

(3) Consultant will achieve mission statement if a central "Contact Us" page is created which provides access to all available channels.

3 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
  • Column, bar, pie, line, and scatter are all types of_____
    9·1 answer
  • You have installed a point-to-point connection using wireless bridges and Omni directional antennas between two buildings. The t
    9·1 answer
  • You just got a shipment of 10 network-attached laser printers. You want these printers to always have the same address but you w
    12·1 answer
  • Write the printItem() method for the base class. Sample output for below program:
    8·1 answer
  • Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus the person's age. Complete fat_burn
    13·1 answer
  • Given the plaintext {0F0E0D0C0B0A09080706050403020100} and the key {02020202020202020202020202020202}: a. Show the original cont
    11·1 answer
  • You are modeling a small part of an online flight reservation system, according to the following description. A flight is a sing
    11·1 answer
  • Through which of the devices listed are we able to connect to wireless networks? Check all that apply.
    14·1 answer
  • An online retailer is looking to implement an enterprise platform. Which component of the enterprise platform will help the comp
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!