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

Which of the following Office Online apps is most effective for creating spreadsheets?

Answers

Answer:

Excel

Explanation:

It allows you to make spreadsheets.

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.

As the senior analyst responsible for data staging, you are responsible for the design of the data staging area. If your data warehouse gets input from several legacy systems on multiple platforms, and also regular feeds from two external sources, how will you organize your data staging area? Describe the data repositories you will have for data staging.

Answers

Answer:

The corresponding schemas I use such as given below.

Explanation:

Dim: Used in the design for certain artifacts belonging to measurements. Fact: Used for these artifacts throughout the design relevant to the truth Admin: Used for all configuration-related artifacts that could be open to professional end-users. Audit: That used to hold audit-related particles. Etl: Is used for keeping objects, particularly staging details, directly connected to something like the ETL method. Report: Used to keep objects utilized explicitly for programs for documentation.Olap: Used for keeping objects directly used for systems for study. Test: Used to carry objects which have been used exclusively for research. Useful- Used to carry objects that just about any member including its implementation may typically use.

Create a bash shell script for a number guessing game. Here are the requirements: a. Your program generates a random number between 0 and 128 and keeps asking the user to guess the number until the user guesses it correctly. b. If the user guesses a number that is lower or higher than the number to be guessed then indicate that information to the user as a ‘low guess’ or a ‘high guess’ so that the user can get to the correct guess quicker. c. The program keeps track on number of guesses taken by the user to get to the correct guess. This is user’s score. d. Your program asks user for the name and adds user’s name and the score in a file that keeps track of the scores by various users. e. At the end of the game, the program displays the top 3 scores (lowest 3 scores) along with the name of the users to conclude the game. John 4 Sam 7 Tony 10

Answers

Answer:

Here is the bash shell script:

scorefile="scores_bash"

guess=-1

typeset -i n=0

echo -e "guess.bash - Guess a number between 0 to 128\n"

(( answer = RANDOM % 128 + 0 ))

while (( guess != answer )); do

n=n+1

read -p "Enter guess $n: " guess

if (( guess < answer )); then

 echo "Low guesss"

elif (( guess > answer )); then

 echo "High guess"

fi

done

echo -e "You guessed the number in $n guesses.\n"

read -p "Enter your name: " name

echo $n $name >> $scorefile

echo -e "\nScores"  

sort -n $scorefile

Explanation:

The program creates a scorefile as scores_bash to store the names and scores. Next the program initializes the guess with -1. guess is used to store the guess made by user and n is used to store the number of trials user took to guess the correct number. Next the program prompts the user to: Guess a number between 0 to 128 and generates random numbers from 0 to 128 and store it into answer.  Next the while loop keeps repeating until the user guesses the correct number. If the user guess is less than the correct answer then the program displays the message Low guess otherwise displays High guess. When the user guesses the correct number, the loop breaks and the message You guessed the number in $n guesses. is displayed where in place of $n the number of trials user take to guess the number is displayed. Next the user is asked to enter his name.

echo $n $name >> $scorefile statement adds the n which is the user score and name which is the names of user to the score file.  sort -n $scorefile  sorts the file in ascending order to display the lowest  scores. The screenshot of program with its output is attached.

What is the purpose of this diamond shape in a flowchart?

Answers

Answer:

To represent a decision making step.

Explanation:

for example, assume that you need to display 'pass' if the total marks are greater than 50 and 'fail' if it's less than 50

Then, after calculating the total, you should draw a diamond and inside it write, 'is total ∠ 50?'

after that you can continue your flowchart taking one decission as 'yes' and the other decission as 'no'

The rectangular shape stands for a task or course of activity. In the flowchart sequence, the diamond shape represents a question or a branch.

What is flowchart?

A flowchart is a diagram that shows a process' individual steps in their proper order.

It is a general tool that may be customised for a wide range of uses and used to define a variety of processes, including a project plan, an administrative or service process, or a manufacturing process.

These four typical forms are excellent for outlining organisational structure, how various departments interact, and economic, industrial, or administrative operations.

In a process, a decision point is represented by a diamond. Usually, the statement in the symbol will call for a "yes" or "no" response and, in accordance, branch to other locations in the flowchart.

Thus, this is the main use of diamond symbol in a flowchart.

For more details regarding a flowchart, visit:

https://brainly.com/question/14598590

#SPJ2

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

Name the application pagram used in creating the
document above​

Answers

Answer:

Excel or Google Sheets

Explanation:

Why does a bus topology require a terminator

Answers

Answer:The purpose of the terminator is to absorb signals so that they do not reflect back down the line

Explanation:

The answer is-

B.) because otherwise the packets will bounce back and forth from end to end repeatedly

Bus topology can be regarded as a kind of topology for a Local Area Network, it is one that has it's nodes connected to a single cable(backbone) and any break in the so called backbone, there will be failure in the entire segment. However a Terminator is usually attached to the end-points of a bus network so that the signal is absorbed by the Terminator and as a result of this the signal will not reflect back down the line. If there is no Terminator there would be bouncing back and forth of packet in an endless loop.It should be noted that a bus topology require a terminator because otherwise the packets will bounce back and forth from end to end repeatedly

Dan works for an automobile company. He has designed a new model of a car based on an older version. Which technology can he use to present the model at a board meeting?
A.
wearable computing
B.
3-D printing
C.
grid computing
D.
screenless display

Answers

Answer:

a

Explanation:

i did the test

Answer:

The answer is B (3-D printing)

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

8. It is a computer component that converts AC power to DC power to be used
by the computer system.

Answers

Answer:

power supply unit.

A power supply unit (PSU) converts mains AC to low-voltage regulated DC power for the internal components of a computer. Modern personal computers universally use switched-mode power supplies.

Explanation:

I HOPE THIS HELPS

PLZ MARK ME AS BRAINLIEST

THANK U!

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

Answers

Flashy page layouts

The one that is not a characteristic developed by New Journalism is flashy page layouts. The correct option is b.

What are flashy page layouts?

The flashy page Layout describes how the document pages will appear after printing. When we check the layout in Word, we can see that the page layout includes components such as margins, column count, and the ability to alter the header and footer.

There are various sorts of layouts, such as magazine layouts, static, adaptable, dynamic, adaptive layouts, and responsive layouts.

The features are as follows:

Page margin dimensions.Image and figure size and placementColumn and gutter count and size (gaps between columns)Intentional white space placement

Therefore, the correct option is b, flashy page layouts.

To learn more about flashy page layouts, refer to the link:

https://brainly.com/question/28702177

#SPJ2

The ____ logic unit is responsible for the execution of arithmetic and logical operations.

Answers

Answer:

The arithmetic/logic unit(ALU)

Explanation:

This unit executes all arithmetic and logical operations through the electrical circuitry it has.

The item in this illustration that is highlighted is _____.



help
the status bar
zoom control
the title bar

Answers

Answer:the title bar

Explanation:

Answer:

I think it's title bar

Explanation:

I'm not positive but another guy said it and its the only one that makes sense

What is one step taken when solving a computer software problem?

Answers

scanning the computer and deleting any viruses

[ if this helped you please give brainliest :) ]

Answer:

B. scanning the computer and deleting any viruses

Explanation:

edge 2020

Meet my horse! ask questions about him too!

Answers

Answer:

no answer, just horse

Explanation:

how much does he eat and is his hair soft? jdnfnnan

Answer:

Hi I have a horse too. He is so handsome

what dicapline do you do?

Explanation:

Urgent Please Help ASAP!! 50 Points!! Assignment due in 15 minutes!!

Reflect on the questions below.

1.) Why do some people resist help from others?
2.) Is it useful to work separately at some point in time during pair programming?
3.) How is pair programming beneficial?
4.) In pair programming, how can we better work together?

Answers

Questions:

1.) Why do some people resist help from others?

2.) Is it useful to work separately at some point in time during pair programming?

3.) How is pair programming beneficial

4.) In pair programming, how can we better work together?

Answers:

1.) Some people are prideful in their work, or they're just embarrassed to ask for assistance.

2.) It can be done, but pair programming is further effective with others.

3.) Pair programming is beneficial because you can get the job done faster.

4.) In pair programming, you can better work with your partner by working on different sections, and then checking each other's tail when the job is almost finished.

These answers are a combination of my knowledge and opinion(s). If you need any more help, do not hesitate to let me know. Glad I could help! :)

True or False:
JavaScript was found in 1923

Answers

Answer:

False. It was in 1995

Explanation:

Answer:

False it was created September 1995.

Explanation:

Use the drop-down menu to complete the steps for using the Autofill feature. Click the . Click the . Drag the to the desired range. Click the Autofill option you want to use.

Answers

Answer:

Cell,fill handle,fill handle

Explanation:

Trust

Answer:

Guy up top is correct, it's Cell, Fill handle, Fill handle, in that order

Explanation:

Which tab is used to configure an export to PST in Outlook 2016?
Send/Receive
File
Home
Review

Answers

Answer:

File Tab

On the topmost ribbon of MS Outlook, go to the File Tab. Click Options>Advanced>Export. From Import and Export wizard, select Export to a file.

The file tab in Outlook 2016 will be used to configure an export to PST. Then, choice B is the best one.

What is outlook?

On your PC, Outlook Desktop App is already installed. You can access it from the Taskbar or the Start menu on your computer (bottom panel of your screen). By logging into your email account using a web browser that you can use Outlook on the web.

By selecting the "Files" icon in Outlook's lower-left corner, you can reach this view. It will be situated between the "People" and "To-Do" icons by default. If you cannot see it but instead have a three-dot icon, click it and then select "Files" from the menu that appears.

The tab used to configure an export to PST in Outlook 2016 will be known as the file tab. Then the correct option is B.

More about the outlook link is given below.

https://brainly.com/question/17457799

#SPJ6

Which is the civil penalty for COPYRIGHTS violations? Choose the answer. $200-$150,000 fine up to five years in jail Fines and court costs 1 year in jail

Answers

Answer: $200-$150,000 fine

Explanation:

I took the Quiz

What is the output?
password = "sdf# 356"
>>> password. isalnum()

Answers

The output is False because the string password contains #.

Answer:

The answer is False.

Explanation:

The answer is false becasue it has other characters than letters and numbers.

Have a great day, I hope this helped.

If String str = "United States";, then what is the value of str.indexOf("united");?

−1
0
1
2
3

Answers

Answer:

-1

Explanation:

due to the fact their is no capital "U" it will -1

what are the software is there ? their uses

Answers

Answer:

Computer software is programming code executed on a computer processor. The code can be machine-level code, or code written for an operating system. An operating system is software intended to provide a predictable and dependable layer for other programmers to build other software on, which are known as applications.

I’m sorry but I don’t think you worded that correctly

Which below best describes JavaScript? *
a) a common dynamic computer language
b) C++ with a different name
c) The study of coding

Please help me out! 23 extra points!

Answers

Answer:

it is a programing languwage that is useualy used to program visual or text based applications

Explanation:

Answer: A

JavaScript is a common dynamic computer language. It was invented decades ago.

C++ is a different way of coding, it is not the answer. Many different people use C++, because they prefer it is easier than JavaScript.

Hope this helps!

Select the correct answer.

What is the drawback of the linear model?

A. communication is only in one direction

B. too much noise is created

C. no feedback is sent on receiving the message

D. long travel between the sender and the receiver

I NEED this asap
20 points

Answers

long travel between the sender and the receiver

Answer:

D. long travel between the sender and the receiver

Explanation:

What is the issue with this code

interface Box2{

static final int ITEM_CODE=201;

int method1();

double method2();
}

public class Window implements Box2{

public int method1(){

return ITEM_CODE;

}

}

public class myFrame{

public static void main(String args[]){

Window w = new Window();

System.out.println(w.method1());

}

}

A.
The interface should be declared as abstract.
B.
The class should be declared as abstract.
C.
The interface should have an implementation of method2.
D.
The class should have an implementation of method2.

Answers

Question: What is the issue with this code

interface Box2{

static final int ITEM_CODE=201;

int method1();

double method2();

public class Window implements Box2{

public int method1(){

return ITEM_CODE;

public class myFrame{

public static void main(String args[]){

Window w = new Window();

System.out.println(w.method1());

A. The interface should be declared as abstract.

B. The class should be declared as abstract.

C. The interface should have an implementation of method2.

D. The class should have an implementation of method2.

Answer: A The interface should be declared as abstract.

Use the drop-down menus to complete the steps for using the Scenario command.


1. Select the cells you want to use in your scenario.


2. Go to the ____ tab.

Data
Home
Insert
Formulas

3. In the Forecast group, select _____ and click Scenario Manager.

Sort
Get Data
Forecast Sheet
What-If Analysis

4. Click Add and fill in the name and add comments if you wish.


5. To compare, you will want to create _____ version.

A what-If
A original
A Data Table

6. Add a second scenario, changing the values from the first.


7. Click _____ to view the values in each scenario.

OK
Show
Review

Answers

Answer:

1. Select the cells you want to use in your scenario.

2. Go to the Data tab.

3. In the Forecast group, select What-if Analysis and click Scenario Manager.

4. Click Add and fill in the name and add comments if you wish.

5. To compare, you will want to create an original version.

6. Add a second scenario, changing the values from the first.

7. Click show to view the values in each scenario.

I got the answer right on Edge :)

The cells a person want to use are:

Go to the Data tab. In the Forecast group, select What-if Analysis and click Scenario Manager.Click Add and fill in the name and add comments if you wish. To compare, you will want to create an original version.

What is cell?

A cell is known to be area that is found on a spreadsheet that is known to be the place where the data are said to be entered.

Note that in the case above, The cells a person want to use are:

Go to the Data tab. In the Forecast group, select What-if Analysis and click Scenario Manager.Click Add and fill in the name and add comments if you wish. To compare, you will want to create an original version

Learn more about cells from

https://brainly.com/question/13920046

#SPJ9

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

An instrument used to measure the amount of electrical current intensity in a circuit

Answers

the instrument is an ammeter
Other Questions
The graph shows the amount of money Joe earns each hour he works. Which statement about the graph is not true? OPTIONS:F. The graph shows a proportional relationship. G. The graph shows a nonproportional relationship. H. The unit rate is $15 hour. I. The line is straight. The need to be secure,safe,and out of danger a parachutist descends 24 feet in 2 seconds. Express the rate of the parachute's change in high as a unit rate . Which term best describes the increasing level of economic, social, cultural, political, and naturalinterconnectedness among people and places throughout the world?A. NationalizationB. LocalizationC. GlobalizationD. Migration If an automobile slows from 26MS to 18 MS in a period of 4.0 S what was the average acceleration Why were workers paid more during the plague? Where the Texans justified in declaring independence from Mexico? How were indentured servants different than slaves? ive been helping yall all night plz help me Help me with my Spanish Pleaae if you know Spanish HELPPP (psychology)__________ is the source error that can be avoided by locating questions sensitive to bias and changing or dropping them.A.Response setB.Deliberate biasC.Social desirabilityD.Response bias Your monthly mortgage payment on your house is $593.90. It is a 30 year mortgage at 7.8% compounded monthly. How much did you borrow Model:Es el padre de mi padre.mi abuelo1. Es la hermana de mi padre.2. Es la madre de mi abuelo.3. Es el hermano de mi esposa.4. Son los hijos de mi to.5. Es la hija de mi madrastra.6. Es el hijo de mi hijo.7. Es el esponso de mi hija For each of the following transactions that occur in their lives, identify whether it is included in the calculation of U.S. GDP as part of consumption (C), investment (I), government purchases (G), exports (X), or imports (M). Check all that apply.Transaction C |I |G| X |M|The Federal Aviation Administration expands the runways at Philadelphia International Airport, which is just a few miles from Antonio and Caroline's house.Dmitri buys a new set of tools to use in his plumbing business.Caroline buys a new BMW, which was assembled in Germany.Antonio's employer assigns him to provide consulting services to an Australian firm that's opening a manufacturing facility in China.Caroline gets a haircut. Help me solve this problem please What is the most likely meaning of the simile in the following sentence?The birds started singing at 5 a.m., sounding like a company of fire engines headed to a huge blaze.A. It suggests that the speaker believes fire engines are too loud.B. It suggests that the birds were communicating an urgent message to one another.C. It suggests that the speaker was woken up by the birds.D. It suggests that the birds were loud and unpleasant sounding. Greg has a table that is 3.75 meters in length. He wants to make a tablecloth that is 20 centimeters longer on each end than the table. What steps should Greg use to determine the correct number of centimeters to make the tablecloth What percent do you actually pay if 40% discount Traders from Islamic lands would spread the ideas of Muslim scholars during their travels along trade routes. What is this an example of? Write the half reactions and the balanced equation for the galvanic cell Cu(s)| Cu2+(aq)|| Cu+(aq)| Cu(s). What is the smallest possible integer coefficient of Cu+(aq) in the combined balanced equation? what makes up a climate in a place?