Respuesta :
For printing a right facing with input 01, define the class for right facing arrow and give the value with appropriate space using '%6d' and then display the right facing arrow.
Further Explanation:
The code to print the arrowhead and arrow body is as follows:
Import java.util.Scanner;
//Define the method.
public class RightfacingArrow
{
//Define the main method.
public static void main(String[] args)
{
//Create an object of Scanner class.
Scanner object = new Scanner(System.in);
//Declare the variables.
int baseChar;
int headChar;
//Prompt the user to enter the input values.
baseChar = object.nextInt();
headChar = object.nextInt();
//Display the headchar in position 6 from the starting.
System.out.printf("%6d ", headChar);
//Display 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+""+headChar+""+headChar);
//Display the headchar in position 6 from the starting.
System.out.printf("%6d ", headChar);
}
}
Output:
If the input is 01, the output will be as below:
1
0000011
00000111
0000011
1
Learn more:
1. A company that allows you to license software monthly to use online is an example of ? https://brainly.com/question/10410011
2. Prediction accuracy of a neural network depends on _______________ and ______________. https://brainly.com/question/10599832
Answer details:
Grade: College Engineering
Subject: Computer Science and Enginnering
Chapter: Java Programming
Keyword:
Java, input, output, programming, statements, if-else, loops, print, scan. right facing arrows, body, main body, char, int, variables, scanner class, abstract class, constructor, desctructor