This program outputs a downwards facing arrow composed of a rectangle and a right triangle. 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)(4) Modify the given program to only accept an arrow head width that is larger than the arrow base width. Use a loop to continue prompting the user for an arrow head width until the value is larger than the arrow b

Answers

Answer 1

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.

This Program Outputs A Downwards Facing Arrow Composed Of A Rectangle And A Right Triangle. The Arrow

Related Questions

I need to know how to input this into python on zybooks. I've been stuck on this for days and I keep running into "invalid syntax" or "unknown word red" Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray). Given values for red, green, and blue, remove the gray part. Ex: If the input is 130 50 130, the output is: 80 0 80 Find the smallest value, and then subtract it from all three values, thus removing the gray.

Answers

Answer:

Here is the C++ program:  

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

using namespace std;   //to identify objects cin cout  

int main() {   //start of main method  

int red,green,blue,smallest;   //declare variables to store integer values of red,green, blue and to store the smallest value  

cout<<"Enter value for red: ";  //prompts user to enter value for red  

cin>>red;  //reads value for red from user  

cout<<"Enter value for green: ";  //prompts user to enter value for green  

cin>>green;  //reads value for green from user  

cout<<"Enter value for blue: "; //prompts user to enter value for blue  

cin>>blue;   //reads value for blue from user  

//computes the smallest value

if(red<green && red<blue) //if red value is less than green and blue values  

smallest=red;   //red is the smallest so assign value of red to smallest  

else if(green<blue)   //if green value is less than blue value  

smallest=green;   //green is the smallest so assign value of green to smallest  

else  //this means blue is the smallest  

smallest=blue;  //assign value of blue to smallest  

//removes gray part by subtracting smallest from rgb  

red=red-smallest;  //subtract smallest from red  

green=green-smallest;  //subtract smallest from green  

blue=blue-smallest;  //subtract smallest from blue  

cout<<"red after removing gray part: "<<red<<endl;  //displays amount of red after removing gray  

cout<<"green after removing gray part: "<<green<<endl;  //displays amount of green after removing gray

cout<<"blue after removing gray part: "<<blue<<endl;  } //displays amount of blue after removing gray  

Explanation:

I will explain the program using an example.  

Lets say user enter 130 as value for red, 50 for green and 130 for blue. So

red = 130  

green = 50  

blue = 130  

First if condition if(red<green && red<blue)   checks if value of red is less than green and blue. Since red=130 so this condition evaluate to false and the program moves to the else if part else if(green<blue) which checks if green is less than blue. This condition evaluates to true as green=50 and blue = 130 so green is less than blue. Hence the body of this else if executes which has the statement: smallest=green;  so the smallest it set to green value.  

smallest = 50  

Now the statement: red=red-smallest; becomes:  

red = 130 - 50  

red = 80  

the statement: green=green-smallest;  becomes:  

green = 50 - 50  

green = 0  

the statement: blue=blue-smallest; becomes:  

blue = 130 - 50  

blue = 80  

So the output of the entire program is:  

red after removing gray part: 80                                                                                                 green after removing gray part: 0                                                                                                blue after removing gray part: 80  

The screenshot of the program along with its output is attached.

describe oxfird cleric​

Answers

Answer:

Explanation:

The Oxford Cleric, or otherwise just known as the Cleric, is from a series of tales called the Canterbury Tales. He had a rather simple life as a cleric and was more commonly seen as a philosopher. The Cleric was just a student who used all of his money on books instead of on clothes and was considered poor.

Which of the following is the primary benefit of becoming a member in the Dramatists Guild of America?


group health insurance

free legal advice

standard salary

networking opportunities

Answers

Answer:

networking opportunities

Explanation:

  The Dramatists Guild of America does offer playwrights legal advice and information on establishing royalties. However, the primary benefit of membership in the DG is networking opportunities. Playwriting is a limited field, and networking opportunities are essential for work.

Which of the following is NOT a characteristic developed by New Journalism?
illustrations and photographs
flashy page layouts
satirical news stories
banner headlines

Answers

Explanation:

I think it's d.

Hope this help

does anyone or has anyone ever done it?? please help it’s for like skills!

Answers

Answer:

is this mathmatics

Explanation:

What is a row of data in a database called?
Field
File
Record
Title

Answers

Answer:

record

Explanation:

i took the test and got it right but give brainliest to the person above me

Y’all know any movie sites I can go on?

Answers

Answer:

Tinseltown

Explanation:

What is the result when you run the following program?

print(“2 + 7”)
print(3 + 1)

Answers

Answer:

line 1 = 2+7 (you added quote marks)

line 2 = 4 (you did not add quote marks, which adds both nums together)

Explanation:

five reasons Why Photographers Aren't Filmmakers

Answers

Answer:

1. They don't like recording things (They'd rather take photos)

2. It doesn't take much time to take a good photo as it is to record a video

3. They'd rather work alone or with others who want pictures taken

Explanation:

These are weird reasons but true..I'm a photographer so these are my reasons. I don't have others tho. Sorry.

35. John makes $700.00 per week working as a janitor at Passaic High School.
What is his CASH INFLOW per month? (SHOW YOUR WORK)(3 points) *

Answers

Explanation:

a is the answer

Translate the following code into hexidecimal and to octadecimal


....
110000100111000011001100111

Answers

Answer:

1

Explanation:

me want brainliest pwease

To simply the task of creating a heading for a science report, a student can create a _____ to run when a specific button is pressed on the quick access toolbar.

i need answer asap
citation

caption

macro

template

Answers

Answer:

macro

Explanation:

The answerrrrr is macro (:

5
Select the correct answer.
Which method is used to transfer information from one computer to another?
O A.
mass communication
B.
point-to-point communication
C.
internet protocol
D.
hard disk
E.
microprocessor

Answers

Answer:

A

Explanation:

If you wanted to mass communication means it imparts and exchanges information on a scale of people so you couple transfer and share your data from one person to another.

Answer: A

Explanation:

In the Page Setup dialog box, the _____ tab gives you options to change the paper size.
a.
Layout
b.
Paper
c.
Sizes
d.
Margins

Answers

Answer:

I think its either layout or sizes

Plz plz plz help QUICKLY idk the answer and I really need help

Answers

Answer:

productivity is the correct answer

The collection of tools and features at the top of the screen is called the
O file
O ribbon
O tab

Answers

TAB THE ANSWER IS TAB

What is the dependent variable, After learning about electricity, a student wants to see if electricity flows better through different materials. Our wonderful student has different materials: copper wire, aluminum wire, carbon fiber, and gold wire. The student attaches a small lightbulb to a 9 volt battery, and uses each wire to see how bright the lightbulb lights up when connected to each material.

Answers

Answer:

The Lightbulb is the dependent variable.

Explanation:

The dependent variable is defined as the variable that the researcher is measuring or testing and it observes the direct effect/change brought by manipulation in the independent variable. In the given experiment, the lightbulb would be characterized as the dependent variable as it is being tested by the researcher. He controls the independent variable(by using different wires) to observe its direct impact on the way the lightbulb lits. Thus, it(lightbulb) is the dependent variable.

I need to finish this assignment today. please help me!

Define: State your Goal What personal value would you like to share with the world?

what does this mean? I don't understand what a personal value is.​

Answers

Answer:

persanal value is the goal

Explanation:

mine would be:

less polution, the value is the goal

Where do i go to find questions to answer
13 points if you can help me PLz

Answers

Answer:

if you are on a phone there should be a Answer tab at the bottom in the middle next to influence but if you are on a computer go to the Brainly home page and scroll down to the bottom (not all the way) and there should be some questions to answer

How do I turn off lanschool student?

Answers

Answer:

First try logging out. If that doesn't work there is a really helpful video on how to uninstall and reinstall with everything still there. Hope this was helpful.

Which of the following are likely reasons people enjoy watching lifelike stories on the screen? Select all that apply.


People develop a connection that is emotional with the stories and/or characters.

The stories remind them of situations they are familiar with.

The situations they see are not familiar to them.

They are distracted by the video and sound combination.

Answers

Answer:

c

Explanation:

I dont know but omost every time I guess I get it right

Answer:

A: People develop a connection that is emotional with the stories and/or characters.

and

D:The stories remind them of situations they are familiar with.

Explanation:

edg2021

What is the difference between internal hardware and software?

Answers

Answer:

Internal Hardware - Internal hardware is the hardware within the computer that you can physically see and touch if you were to take apart the computer.

Internal Software - Internal software is software within the computer that you cannot physically touch. It is a collection of programming code installed on your computer's hard drive.

Explanation:

Answer:

D.  Internal hardware is physical parts that help the computer work; software is the programs and applications that make the computer work.

Explanation:

Just finished this section

does anyone have a pdf of the greatest by eddie van der meer????

Answers

Answer

aight' so im finding it but i have to asnwer before someone else so look in the comments for it.

Explanation:

Just wait i getting it rn

what is computer?write feature of computer​

Answers

Answer:

An electronic device for storing and processing data, typically in binary form, according to instructions given to it in a variable program is computer.

And it's feature are:

Multitasking.Accurate & Speed.Efficient.Reliability.Recoverability

what is a computer?.

a computer is a electronic device that works under the control of information stored in its memory.

features of a computer

multitasking.

i really need help please im about to give up

Answers

Answer:

true

Explanation:

because I ain't stupid

Which graphic file format would you choose if you needed to make an animated graphic for a website?

ai

png

gif

py
please help

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct option for this question is gif.

Gif is a series of images that are used as animated graphics for a website. A gif is the file format of an animated image. You may have seen many animated images on websites like stickers etc.

other options are not correct because:

ai: is adobe illustrator file format

png: png is an image file format but not for an animated image

py: py is a file extension of the python file.

Answer:

gif

Explanation:

Farm tools/Equipment:
Parts:
Quantity:
Defect type
manufacturing/Design/marketing
Condition​

Answers

Answer:

sorry but I don't understand your question can you elaborate it better

Answer:

Farm/Equipment:

Preparation , Mechanical processing , Heat processing , Preservation , Packaging

Parts:

Tractor, backhoe, baler, plow, harrows, seed drill

Quantity:

Farmers must learn how to manage both soil and water resources in an integrated manner

Defect Type:

Broken bones , Crush injuries , Burns , Electrocution , Spinal cord and, traumatic brain injuries , Amputation injuries

Manufacturing/Design/Marketing :

Internal resource constraints for new product development

Eroding margins due to higher material and assembly costs

Low throughput

Inefficient workflows resulting in higher cost of manufacturing

Rising warranty costs

Condition​: Vibration Analysis/Dynamic Monitoring:

Shock pulse analysis

Fast fourier transforms

Broadband vibration analysis

Ultrasonic analysis

Power spectral density (PSD)

Time waveform analysis

Spectrogram/spectrum analysis

Hope this helps

idk just anwser this and get get some points lol

Answers

Answer:

ok thxxxxx :)

Explanation:

Answer:

thank you

Explanation:

D
E
A
C
B
For this lab, you will find the area of an irregularly shaped room with the shape as shown above.
Ask the user to enter the values for sides A, B, C, D, and E and print out the total room area.
Remember the formula for finding the area of a rectangle is length width and the area of a right triangle is 0.5 * the base" heigh
Please note the final area should be in decimal format.
Sample Run
Enter side A: 11
Enter side B: 2
Enter side C: 4
Enter side D: 7
Enter side E: 1
Sample Output
Room Area: 53.5

Answers

In python:

a = float(input("Enter side A: "))

b = float(input("Enter side B: "))

c = float(input("Enter side C: "))

d = float(input("Enter side D: "))

e = float(input("Enter side E: "))

print(f"Room Area: {(a * b) + ((a - c) * (d - (b + e))) + (0.5*(a - c) * e)}")

I hope this helps!

Which utility causes the computer to run slow? defragmentation utility OR compression utility?

Answers

Answer:

compression

Explanation:

Other Questions
Why would a country invest in human capital How did the followers of john calvin contribute to American colonial history What was Roger Griswolds opinion about the Louisiana purchase 5 1/3% is equal in fraction to 4/75 true or false Why did the founding fathers separate the powers of government between the three branches? do you think i am i guy or a girl Which of them is correct? I'm like, slow right now. Create the polynomial which has roots 3and 2 Six gallons of gasoline cost $15.06. What is the price of gasoline per gallon multiply 3 2/5 x 2 1/3 a student is using colored beads to make a model of aluminum sulfate, Al2(SO4)3.Aluminum atoms are represented by green beads, sulfur atoms by blue beads, andoxygen atoms by yellow beads. What combination of beads should the student use forthe model? Rashid lifts a flower pot 0.8m off the floor using a constant force of 20 N. How much work is done on the flower pot? Why do you think history is often referred to as social science What does a strongly supported inference need? *A.Background knowledge and textual evidence that answers the question or writing prompt. B.Lots of textual evidence. The more the better!C.Background knowledge and an explanation of why the narrator is writing the text. What's the answer please Which of the following terms represents the debate between genetic and environmental influences on behavior?A.stability versus changeB.continuity versus stagesC.nature versus nurtureD.general versus multiple What is the main reason behind the conflict between the Shiites and the Sunnis?the passing of powerthe official languagethe rights to oil reservesthe Israeli border Where did the US government relocate the Cheyenne, Arapaho, and Plains Apache tribes?A. southwestern Kansas and northwestern Indian TerritoryB. western Indian Territory and the Texas PanhandleC. the Cherokee Outlet and the Leased DistrictD. western Texas and northern Indian Territory SOMEONE PLEASE HELP MEWhich of the following are most clearly purposes of the author in this passage? Choose two options. A. to inform readers about techniques of singers B. to entertain readers with an amusing story C. to inform readers about some risks of performance D. to inform readers about some events in his life E. to persuade readers that music can involve humor Select all of the perfect squares from the list: 1, 3, 4, 81, 196, 171, 200, 215, 289, 361Group of answer choices13481196171200215289361PLEASE ITS TIMED