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
Anton [14]
2 years ago
10

write a loop that reads positive integers from stands input and that terinated when it reads an interger that is not positive af

ter the loop termpinates
Computers and Technology
1 answer:
gtnhenbr [62]2 years ago
5 0

Loop takes only positive numbers and terminates once it encounters a negative numbers.

Answer and Explanation:

Using javascript:

Var positiveInt= window.prompt("insert positive integer");

While(positiveInt>=0){

Alert("a positive integer");

Var positiveInt= window.prompt("insert positive integer");

}

Or we use the do...while loop

Var positiveInt= window.prompt("insert positive integer");

do{

Var positiveInt= window.prompt("insert positive integer");

}

While (positiveInt>=0);

The above program in javascript checks to see if the input number is negative or positive using the while loop condition and keeps executing with each input until it gets a negative input

You might be interested in
The default print setting for worksheets is________
frez [133]

Answer:

Print Active Sheets .

Explanation:

This question refers to the default printing system of the Excel program. Thus, when printing a job using this program, the default option will print all the active sheets, that is, all those spreadsheets where information has been entered. To be able to print in another option, such as selecting certain cells, rows or columns, you must configure the printing for this purpose.

5 0
2 years ago
You have to communicate a signal in a language that has 3 symbols A, B and C. The probability of observing A is 50% while that o
Vlada [557]

Answer:

Huffman code is use for encoding the language. The entropy when calculated is 1.5.

Explanation:

Using Huffman Coding scheme to encode:

The huffman coding scheme is described in the attachment.

To find entropy; we use the formula given below:

H = ∑p log_{2}  \frac{1}{p}

where H = Entropy and p = probability

p(A) = 50% = 1/2

p(B) = 25% = 1/4

p(C) = 25% = 1/4

H = \frac{1}{2} log_{2} 2 + \frac{1}{4}  log_{2} 4+ \frac{1}{4} log_{2}4\\H = \frac{1}{2}(1) + \frac{1}{4}(2) + \frac{1}{4}(2)\\H = \frac{1}{2} + \frac{2}{4} + \frac{2}{4}\\H = \frac{1}{2} + \frac{1}{2} + \frac{1}{2}\\H = \frac{3}{2}\\H = 1.5

Download pdf
7 0
3 years ago
Select all examples of proper keyboarding technique.
emmasim [6.3K]
Keep your eyes on the text and aim to make no mistakes
4 0
3 years ago
Read 2 more answers
Write a test program that creates two Rectangle objects—one with width 4 and height 40 and the other with width 3.5 and height 3
BARSIC [14]

Answer:

public class Rectangle {

   private double width;

   private double heigth;

   public Rectangle(double width, double heigth) {

       this.width = width;

       this.heigth = heigth;

   }

   public double getWidth() {

       return width;

   }

   public void setWidth(double width) {

       this.width = width;

   }

   public double getHeigth() {

       return heigth;

   }

   public void setHeigth(double heigth) {

       this.heigth = heigth;

   }

   public double perimeter(double width, double heigth){

       double peri = 2*(width+heigth);

       return peri;

   }

   public double area(double width, double heigth){

       double area = width*heigth;

       return  area;

   }

}

class RectangleTest{

   public static void main(String[] args) {

       //Creating two Rectangle objects

       Rectangle rectangle1 = new Rectangle(4,40);

       Rectangle rectangle2 = new Rectangle(3.5, 35.7);

       //Calling methods on the first Rectangel objects

       System.out.println("The Height of Rectangle 1 is: "+rectangle1.getHeigth());

       System.out.println("The Width of Rectangle 1 is: "+rectangle1.getWidth());

       System.out.println("The Perimeter of Rectangle 1 is: "+rectangle1.perimeter(4,40));

       System.out.println("The Area of Rectangle 1 is: "+rectangle1.area(4,40));

       // Second Rectangle object

       System.out.println("The Height of Rectangle 2 is: "+rectangle2.getHeigth());

       System.out.println("The Width of Rectangle 2 is: "+rectangle2.getWidth());

       System.out.println("The Perimeter of Rectangle 2 is: "+rectangle2.perimeter(4,40));

       System.out.println("The Area of Rectangle 2 is: "+rectangle2.area(4,40));

   }

}

Explanation:

  • Firstly A Rectangle class is created with two fields for width and heigth, a constructor and getters and setters the class also has methods for finding area and perimeters
  • Then a RectangleTest class containing a main method is created and two Rectangle objects are created (Follow teh comments in the code)
  • Methods to get height, width, area and perimeter are called on each rectangle object to print the appropriate value
5 0
2 years ago
The numeric keys on the keyboard are sometimes called the ten keypad. true false
mr_godi [17]
The answer is true...
8 0
2 years ago
Read 2 more answers
Other questions:
  • Write a function, factors, that takes an integer n, and returns a list of values that are the positive divisors of n. Note: 0 is
    13·1 answer
  • Your browsing the Internet and realize your browser is not responding which of the following will allow you to immediately exit
    14·2 answers
  • In Windows Vista, the Run command can be found in which application?
    6·1 answer
  • If the base-10 system stops with the<br> number 9, then why isn't it called<br> base-9?
    15·1 answer
  • How we know that how many domain exist in window server 2012?
    14·1 answer
  • Which of the selection below does not represent a workable IP address?
    9·1 answer
  • To exit Access, click the ____ button on the right side of the Access title bar.
    9·1 answer
  • Along a road lies a odd number of stones placed at intervals of 10 metres. These stones have to be assembled around the middle s
    12·1 answer
  • Which of the following statements holds true for the term plug-in? Group of answer choices It refers to a program (typically a m
    11·1 answer
  • LIST THE 7 BEST PROGRAMMING MOVIES 2020-2021.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!