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
Bezzdna [24]
3 years ago
12

Given decimal variables named length and width that contain the dimensions of a rectangle, write a statement that calculates the

rectangle’s area and saves the result in a new integer variable named area. (Be sure to cast the result from decimal to integer.)
Computers and Technology
1 answer:
kirill [66]3 years ago
3 0

Answer:

The code to this question can be defined as follows:

<u>Code:</u>

int area = (int) (length * width); //defining integer variable area that holds calculated value.

Explanation:

In the given question it is defined, that two decimal variable "length and width" is defined that holds some decimal value in it, and this question asks to define an integer that holds it calculated value, which can be described as follows:

  • In the above code section, an integer variable "area" is defined, which calculates the decimal variable "length and width" multiplication.
  • Inside the area variable, the typecasting is used that converts the decimal value to integer value.  
You might be interested in
Write a method that returns a version of the given array where all the 10's have been removed. The remaining elements should shi
Harlamova29_29 [7]

Answer:

The removeTens method is as follows

public static int[] removeTen(int[] nums) {

int [] arr = nums;

   int index = 0;

   while(index < arr.length && arr[index] != 10){

       index++;

   for(int j = index + 1; j < arr.length; j++) {

       if(arr[j] != 10) {

           arr[index] = arr[j];

           arr[j] = 10;

           index++;        }    }

   for( ; index < arr.length; index++){

       arr[index] = 0;}}

   return arr;

}

Explanation:

This defines the removeTens method; it receives array nums as its parameter

public static int[] removeTen(int[] nums) {

This creates and initializes a new array

int [] arr = nums;

This initializes index to 0

   int index = 0;

The following is repeated when array element is not 10 and if array index is still valid

   while(index < arr.length && arr[index] != 10){

This increments the index by 1

       index++;

This iterates through the array

   for(int j = index + 1; j < arr.length; j++) {

This checks if array element is not 10

       if(arr[j] != 10) {

If yes:

           arr[index] = arr[j];

The current array element is set to 10

           arr[j] = 10;

The index is incremented by 1        

  index++;        }    }

This iterates through the array again and move 0s to the back

   for( ; index < arr.length; index++){

       arr[index] = 0;}}

This returns the new array

  return arr;

}

8 0
2 years ago
In your opinion is it more beneficial to have many folders or is it better to nest subfolders
Semmy [17]
I dont think it matters just as long you have all your things to work it doesnt matter if you have to tape it on your back
7 0
3 years ago
If an engine has four cylinders and a total of 16 valves, how many valves would each cylinder have? A. Two B. One C. Four D. Thr
scZoUnD [109]
The correct response is C. Four.
6 0
3 years ago
90 POINTS Hazel is working with a database to help determine if the company she works for is making or losing money. Hazel has o
VikaD [51]

Answer:

a

Explanation:

5 0
2 years ago
Read 2 more answers
Which devices typically generate computer output ?
Andrews [41]
Monitor , printer , speaker , projector , keyboard etc
6 0
3 years ago
Read 2 more answers
Other questions:
  • The use of computers to combine data from multiple sources and create electronic dossiers of detailed information on individuals
    8·1 answer
  • What is a row of data in a database called?<br> Field<br> File<br> Record<br> Title
    10·1 answer
  • Biomimicry is the term used when engineers are inspired by objects found in nature? Group of answer choices True False
    10·1 answer
  • A stateless firewall inspects each incoming packet to determine whether it belongs to a currently active connection.
    9·1 answer
  • Alan has introduced a new line of scooters on his website and is using a Google Display Ad campaign to promote them. He selects
    8·1 answer
  • I need help picture above
    14·2 answers
  • Please i relly need this! ​
    11·1 answer
  • What are the specifications for a mine shaft headgear ​
    10·1 answer
  • What is the meaning of FTTH
    9·2 answers
  • Describe comm<br>unication cycle​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!