Question: FOR JAVA PLEASE: SIMPLE CODE: 1 . 4 2 LAB: Input and formatted output: Right - facing arrow Given two input integers for an arrowhead

FOR JAVA PLEASE: SIMPLE CODE: 1.42 LAB: Input and formatted output: Right-facing arrow
Given two input integers for an arrowhead and arrow body, print a right-facing arrow.
Ex: If the input is: 01
the output is:
1
11
00000111
000001111
00000111
11
1import java.util.Scanner;
public class LabProgram {
public static void main(String[] args){
Scanner scnr = new Scanner(
System.in);
int baseChar;
int headChar;
/* Type your code here. */
}
}
I used the following code: import java.util.Scanner;
public class LabProgram {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
System.out.print("Enter the base character: ");
char baseChar = scanner.next().charAt(0);
System.out.print("Enter the head character: ");
char headChar = scanner.next().charAt(0);
System.out.println(""+ headChar);
System.out.println(""+ headChar + headChar);
for (int i =0; i 3; i++){
for (int j =0; j 5; j++){
System.out.print(baseChar);
}
if (i ==0|| i ==2){
System.out.println(headChar +""+ headChar +""+ headChar);
} else {
System.out.println(headChar +""+ headChar +""+ headChar +""+ headChar);
}
}
System.out.println(""+ headChar +""+ headChar);
System.out.println(""+ headChar);
scanner.close();
}
}
I received the following errors:LabProgram.java:8: error: cannot find symbol
char baseChar = scanner.next().charAt(0);
^
symbol: variable scanner
location: class LabProgram
LabProgram.java:11: error: cannot find symbol
char headChar = scanner.next().charAt(0);
^
symbol: variable scanner
location: class LabProgram
LabProgram.java:31: error: cannot find symbol
scanner.close();
^
symbol: variable scanner
location: class LabProgram
3 errors
Now I am ggetting the following: 1:Compare output
0/5
Output differs. See highlights below.
Special character legend
Input
01
Your output
1
11
0000011
000001
0000011
Expected output
1
11
00000111
000001111
00000111
11
1
 FOR JAVA PLEASE: SIMPLE CODE: 1.42 LAB: Input and formatted output:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!