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
umka2103 [35]
1 year ago
8

Given positive integer num_insects, write a while loop that prints that number doubled up to, but without exceeding 100. Follow

each number with a space. Sample output with input: 8 8 16 32 64
Computers and Technology
1 answer:
nasty-shy [4]1 year ago
5 0

Answer:

import java.util.Scanner;

public class CocaColaVendingTest {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter value for number of insects");

       int num_insects = in.nextInt();

       while (num_insects<=100){

           System.out.print(num_insects);

           num_insects*=2;

           System.out.print(" ");

       }

   }

}

Explanation:

In the code above written in Java.

The user is prompted to enter a positive value for the number of insects

This is stored in a variable num_insects.

Using a while loop with the condition while (num_insects<=100). The num_insects is printed out. Then it is doubled followed with a space.

It continues until the condition in the while loop is no longer true

You might be interested in
You need to design a data storage scheme for Hayseed Heaven library data system. There are several hundred thousand large data r
Alekssandra [29.7K]

Answer:

Make use of hash tables

Explanation:

The appropriate thing to use for this should be a hash table.

A Hash Table can be described as a data structure which stores data in an associative manner. In a hash table, data is stored in an array format, where each data value has its own unique index value. Access of data becomes very fast if we know the index of the desired data. So we can perform Hashing on ISBN Number since its unique and based on the Hash Function w ecan store the Information record.

There is no requirement for printing the file in order - HashTables dont store the data in order of insertions, so no problems with that

It becomes a data structure in which insertion and search operations are very fast irrespective of the size of the data. So Querying books details can be fast and searching will take less time.

It can also be pointed out that it wont be too expensive for Hardware implemtation as HashTables stores data based on Hash Functions and memory consumption is also optimal which reduces memory wastages.

7 0
2 years ago
Program MATH_SCORES: Your math instructor gives three tests worth 50 points each. You can drop one of the test scores. The final
Simora [160]

Answer:

import java.util.Scanner;

public class num5 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       //Prompt and receive the three Scores

       int score1;

       int score2;

       int score3;

       do {

           System.out.println("Enter first Score Enter score between 1 -50");

           score1 = in.nextInt();

       } while(score1>50 || score1<0);

       do {

           System.out.println("Enter second Score.The second score must be between 1 -50");

           score2 = in.nextInt();

       } while(score2>50 || score2<0);

       do {

           System.out.println("Enter Third Score Third score must between 1 -50");

           score3 = in.nextInt();

       } while(score3>50 || score3<0);

       //Find the minimum of the three to drop

       int min, min2, max;

       if(score1<score2 && score1<score3){

           min = score1;

           min2 = score2;

           max = score3;

       }

       else if(score2 < score1 && score2<score3){

           min = score2;

           min2 = score1;

           max = score3;

       }

       else{

           min = score3;

           min2 = score1;

           max = score2;

       }

       System.out.println("your entered "+max+", "+min2+" and "+min+" the min is");

       int total = max+min2;

       System.out.println("Total of the two highest is "+total);

       //Finding the grade based on the cut-off points given

       if(total>=90){

           System.out.println("Grade is A");

       }

       else if(total>=80){

           System.out.println("Grade is B");

       }

       else if(total>=70){

           System.out.println("Grade is C");

       }

       else if(total>=60){

           System.out.println("Grade is D");

       }

       else{

           System.out.println("Grade is F");

       }

   }

}

Explanation:

  • Implemented with Java
  • Use the scanner class to receive user input
  • Use a do.....while loop to validate user input for each of the variables. A valid score must be between 0 and 50 while(score>50 || score<0);  
  • Use if and else to find the minimum of the three values and drop
  • Add the two highest numbers
  • use if/else if /else statements to print the corresponding grade
8 0
1 year ago
Write a program to help you feed your friends at a party by doing some math about square pizzas. Assume the grader defines a str
Nina [5.8K]

Answer:

Following are the program in the Python Programming Language.

#get input from the user length of the pizza

inputStr = input('Enter the length of pizza: ')

#convert input into float

L = float(inputStr)

#initialize the area of the pizza

A = L*L

#calculate the amount of peoples can eat pizza

men = int(A/100)

#print the number of peoples

print('\nPizza can be eaten by {} people'.format(men))

<u>Output</u>:

Enter the length of pizza: 20

Pizza can be eaten by 4 people

Explanation:

<u>Following are the description of the program</u>.

  • Firstly, set a variable that get length input from the user.
  • Set variable 'L' that convert the input from the user into the float data type.
  • Set variable 'A' that stores the area of the pizza.
  • Set variable 'men' that store the amount of peoples can eat pizza.
  • Finally, print the number of peoples can eat pizza.
3 0
2 years ago
Which collaboration technology is becoming more and more popular within organizations because it provides a means for forming ad
Leona [35]

Answer:

d) Social networking sites

Explanation:

-Intranet is a network that is created by an organization to share information, tools and different services inside the company.

-Wikis are websites used to share content and knowledge and different users can modify the information.

-VoIP is a technology that allows you to make calls over the internet.

-Social networking sites are online platforms that allow people to connect with organizations and other people, create communities online and share different types of information.

-Unified communications is a system that has different communication methods through a single application.

According to this, the collaboration technology that is becoming more and more popular within organizations because it provides a means for forming ad hoc groups, networking and locating potential business allies is social networking sites.

8 0
1 year ago
The Company management has asked that you compare the OSSTMM and the PTES to determine which methodology to select for internal
Sonbull [250]

Answer:

The basic comaprism of OSSTMN and PTES includes the following: OSSTMN is more theoretical, security assessment methodology, and Metrics based why PTES is technology oriented, penetration testing methodology ,  extended analysis of all stages

Explanation:

Solution

Penetration testing has several methodologies which include :OSSTMM and PTES  

The comparison between OSSTMM and PTES is stated as follows:

OSSTMM:                                                

Security assessment methodology

More Theoretical  

Metrics based

PTES :

Technology oriented

Penetration testing methodology

Extended analysis of all stages

Now,

There are 7 stages which is used to define PTES for penetration testing.(Penetration Testing Execution Standard)

  • Pre-engagement Interactions
  • Intelligence Gathering
  • Threat Modeling
  • Vulnerability Analysis
  • Exploitation
  • Post Exploitation
  • Reporting

Now,

The OSSTMM is used to obtain security metrics and performing penetration testing .The OSSTMM provides transparency to those who have inadequate security policies and configurations.

The OSSTMM includes the entire risk assessment process starting from requirement analysis to report creation.

Six areas are covered by OSSTMM which are:

  • Information security
  • Process security
  • Internet technology security
  • Communications security
  • Wireless security
  • Physical security
7 0
1 year ago
Other questions:
  • Email, instant messaging and most web traffic go across the internet in the clear; that is, anyone who can capture that informat
    15·2 answers
  • Which statements describe the advantages of using XML?
    12·2 answers
  • Software code is tested, debugged, fixed, verified, and then:
    11·1 answer
  • Address the FIXME comments. Move the respective code from the while-loop to the created function. The add_grade function has alr
    14·1 answer
  • The following checksum formula is widely used by banks and credit card companies to validate legal account numbers: d0 + f(d1) +
    13·1 answer
  • Question 1 :Which type of unshielded twisted pair (UTP) cable is commonly used for 1000BASE-T Ethernet networks and is often mad
    8·1 answer
  • As a digital forensics examiner, it’s a good idea to build a list of references for information on privacy laws in other countri
    13·1 answer
  • A company decides to relocate its operations to another state in order to take advantage of some new business investment credits
    15·1 answer
  • A large Internet merchandise provider determines its shipping charges based on the number of items purchased. As the number incr
    6·1 answer
  • Return 1 if ptr points to an element within the specified intArray, 0 otherwise.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!