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
Zina [86]
4 years ago
6

3.24 Program: Drawing a half arrow (Java) This program outputs a downwards facing arrow composed of a rectangle and a right tria

ngle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width. (1) Modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (1 pt) (2) Modify the given program to use a loop to output an arrow base of width arrowBaseWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow base. (1 pt) (3) Modify the given program to use a loop to output an arrow head of width arrowHeadWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow head. (2 pts)

Engineering
1 answer:
Lostsunrise [7]4 years ago
8 0

Answer:

Here is the JAVA program:

import java.util.Scanner; // to get input from user

public class DrawHalfArrow{ // start of the class half arrow

public static void main(String[] args) { // starts of main() function body

    Scanner scnr = new Scanner(System.in); //reads input

int arrowBaseHeight = 0; // stores the height of arrow base

int arrowBaseWidth  = 0; // holds width of arrow base

int arrowHeadWidth = 0; // contains the width of arrow head

// prompts the user to enter arrow base height, width and arrow head width

System.out.println("Enter arrow base height: ");

arrowBaseHeight = scnr.nextInt(); // scans and reads the input as int

System.out.println("Enter arrow base width: ");

arrowBaseWidth = scnr.nextInt();

/* while loop to continue asking user for an arrow head width until the value entered is greater than the value of arrow base width */

while (arrowHeadWidth <= arrowBaseWidth) {

    System.out.println("Enter arrow head width: ");

    arrowHeadWidth = scnr.nextInt(); }

//start of the nested loop

//outer loop iterates a number of times equal to the height of the arrow base

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

//inner loop prints the stars asterisks

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

          System.out.print("*");        } //displays stars

          System.out.println();          }

//temporary variable to hold arrowhead width value

int k = arrowHeadWidth;

//outer loop to iterate no of times equal to the height of the arrow head

for (int i = 1; i <= arrowHeadWidth; i++)

{     for(int j = k; j > 0; j--)     {//inner loop to print stars

       System.out.print("*");    } //displays stars

   k = k - 1;

   System.out.println(); } } } // continues to add more asterisks for new line

Explanation:

The program asks to enter the height of the arrow base, width of the arrow base and the width of arrow head. When asking to enter the width of the arrow head, a condition is checked that the arrow head width arrowHeadWidth should be less than or equal to width of arrow base arrowBaseWidth. The while loop keeps iterating until the user enters the arrow head width larger than the value of arrow base width.

The loop is used to output an arrow base of height arrowBaseHeight. So point (1) is satisfied.

The nested loop is being used which as a whole outputs an arrow base of width arrowBaseWidth. The inner loop draws the stars and forms the base width of the arrow, and the outer loop iterates a number of times equal to the height of the arrow. So (2) is satisfied.

A temporary variable k is used to hold the original value of arrowHeadWidth so that it keeps safe when modification is done.

The last nested loop is used to output an arrow head of width arrowHeadWidth. The inner loop forms the arrow head and prints the stars needed to form an arrow head. So (3) is satisfied.

The value of temporary variable k is decreased by 1 so the next time it enters  the nested for loop it will be one asterisk lesser.

The screenshot of output is attached.

You might be interested in
How do I draw this from the side?
tangare [24]

Answer:

draw it 3D

Explanation:

because it's a 3D picture

6 0
3 years ago
An asphalt concrete mixture includes 94% aggregates by weight. The specific gravity of aggregate and asphalt are 2.7 and 1.0, re
riadik2000 [5.3K]

Answer:

The correct solution is "5.74%".

Explanation:

The given values are:

Gravity of aggregate,

G_{agg}=2.7

Gravity of asphalt,

G_{asp}=1.0

Asphalt concrete mixture,

W_{agg}=0.94 \ W_m

We know that,

W_{asp}=W_m-W_{agg}

        =0.06 \ W_m

Now,

The theoretical specific gravity of mix,

⇒ G_t=\frac{W_{agg}+W_{asp}}{\frac{W_{agg}}{G_{agg}} +\frac{W_{asp}}{G_{asp}} }

By putting the values, we get

         =\frac{0.94 \ Wm+0.06 \ Wm}{\frac{0.94 \ Wm}{2.7} +\frac{0.06 \ Wm}{1} }

         =2.45

hence,

The percentage of voids will be:

⇒  %V = \frac{G_t-G_m}{G_t}\times 100

           = \frac{2.45-2.317}{2.45}\times 100

           = \frac{0.133}{2.317}\times 100

           = 5.74 (%)  

8 0
3 years ago
Select the correct answer.
scoundrel [369]
A is your answer choice
8 0
3 years ago
A Charpy V Notch test was conducted for an ASTM A572 Grade 50 bridge steel. The average values of the test results at four diffe
goldenfox [79]

Answer:

Explanation: see attachment below

5 0
4 years ago
Consider a single bacterial cell as a discrete particle with a diameter of 1x10-6m and a specific gravity of 1.01. Assuming lami
Alinara [238K]

Answer:

Sedimentation is not a good method.

Explanation:

We need to apply Stoke laws and assume that is valid here.

So,

V_s= 418(G-1)d^2(\frac{3T+70}{100})

Replacing the values,

V_s= (418)(1.01-1)(10^-3)^3*(\frac{3*20+70}{100})\\V_s=5.434*10^-6mm/s

Here then we calculate the time,

t_{req}=\frac{x}{v}

Where x= Distance, v= velocity

t_{req}=\frac{1foot}{5.434*10^{-6}} = \frac{304.8}{5.434*10^{-6}}\\t_{req}=649.2days

To calculate the surface required we need first to calculate the volume through the volume,

So,

Q=4MGD=4*10^6*0.135 (ft^3/day)

Then,

V_{req} = Q*t\\V_{req}=4*10^6*0.134*649.2\\V_{req}=34.79*10^7ft^3

Here we can calculate the surface

S_{req}= \frac{Volume}{Distance}=\frac{34.79*10^7}{1}\\S_{req}=7987.8 Acres

<em>So, the requeriment of Area of tank and settlement time is huge, it's not a practical method.</em>

6 0
3 years ago
Other questions:
  • What is advantage and disadvantage of flat top sampling in digital signal trasmission?​
    9·1 answer
  • Martensitic transformations only occur in the Fe-C system. ___ Certain materials can age harden at room temperature. ___ Pure me
    7·1 answer
  • Two pressure gauges measure a pressure drop of 16.3 psi (lb/in.2) at the entrance and exit of an old buried pipeline. The origin
    13·1 answer
  • Opposition to current flow, restricts or resists current flow
    15·1 answer
  • I really need help with my last topic,Hazard communication,if anyone can help me as soon as possible,that could be my Christmas
    12·1 answer
  • What is the best way to cut a taper
    5·2 answers
  • TE
    13·1 answer
  • I will give Brainliest, please help. :)
    11·2 answers
  • 1) Which step in the Design Process utilizes technical drawings to provide information necessary to
    8·1 answer
  • How to write a 5bit register if a series is moved to the shift register from left to right
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!