answer.
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
Elis
3 months ago
8

Given two input integers for an arrowhead and arrow body, print a right-facing arrow. Ex: If the input is 0 1, the output is

Engineering
1 answer:
alex41 [359]3 months ago
8 0

To print a right-facing arrow using the input 01, first create a class for the arrow and set the space value properly with '%6d' before showing the arrow.

Further Explanation:

The following code prints the arrowhead and body:

Import java.util.Scanner;

//Define the method.

public class RightfacingArrow

{

//Define the main method.

public static void main(String[] args)

{

//Create an instance of Scanner.

Scanner object = new Scanner(System.in);

//Declare the variables.

int baseChar;

int headChar;

//Ask user for input values.

baseChar = object.nextInt();

headChar = object.nextInt();

 

//Show the head character with a space of 6 from the start.

System.out.printf("%6d ", headChar);

//Print the arrows.

System.out.println(baseChar + "" + baseChar + ""

+ baseChar + "" + baseChar + "" + baseChar + ""

+ headChar + "" + headChar);

System.out.println(baseChar + "" + baseChar

+ "" + baseChar + "" + baseChar + "" + baseChar

+ "" + headChar + "" + headChar + "" + headChar);

System.out.println(baseChar + "" + baseChar

+ "" + baseChar + "" + baseChar + "" + baseChar

+ baseChar + "" + headChar + "" + headChar);

//Show the head character with a space of 6 from the start.

System.out.printf("%6d ", headChar);

}

}

Output:

If you input 01, the output will appear as follows:

    1

0000011

00000111

0000011

    1

Answer details:

Grade: College Engineering

Subject: Computer Science and Engineering

Chapter: Java Programming

Keywords:

Java, input, output, programming, statements, if-else, loops, print, scan, right-facing arrows, body, main body, char, int, variables, scanner class, abstract class, constructor, destructor

You might be interested in
A copper-constantan thermocouple is to be used to measure temperatures between 0 and 200°C. The e.m.f. at 0°C is 0 mV, at 100°C
Kisachek [356]
3.941%
5 0
1 month ago
Which of the following types of protective equipment protects workers who are passing by from stray sparks or metal while anothe
choli [298]

Answer:

Flame-resistant clothing and aprons

Explanation:

Workers involved with welding are generally mandated to wear flame-resistant clothing and aprons to shield them from various hazards, including heat, flames, burns, and potential radiation. In the context of welding, this gear protects individuals from flying sparks that can ignite and cause fires. Hence, such clothing helps to prevent accidents in these situations.

7 0
3 months ago
Other questions:
  • A Carnot heat engine receives heat from a reservoir at 900oC at a rate of 800 kJ/min and rejects the waste heat to the ambient a
    13·1 answer
  • A sign erected on uneven ground is guyed by cables EF and EG. If the force exerted by cable EF at E is 46 lb, determine the mome
    13·1 answer
  • A test machine that kicks soccer balls has a 5-lb simulated foot attached to the end of a 6-ft long pendulum arm of negligible m
    12·1 answer
  • NEEDS TO BE IN PYTHON:ISBN-13 is a new standard for indentifying books. It uses 13 digits d1d2d3d4d5d6d7d8d910d11d12d13 . The la
    15·1 answer
  • A bankrupt chemical firm has been taken over by new management. On the property they found a 20,000-m3 brine pond containing 25,
    13·1 answer
  • 1. A four-lane freeway (two lanes in each direction) is located on rolling terrain and has 12-ft lanes, no lateral obstructions
    7·1 answer
  • At what forward voltage does a diode conduct a current equal to 10,000 Is ? In terms of Is , what current flows in the same diod
    14·1 answer
  • A thermocouple element when taken from a liquid at 50°C and plunged into a liquid at 100° C at time t = 0 gave the following e.m
    11·1 answer
  • 3 If, for a particular junction, the acceptor concentration is 1017/cm3 and the donor concentration is 1016/cm3 , find the junct
    6·1 answer
  • Suppose a possibly biased die is rolled 30 times and that the face containing
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!