Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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: LAB: Input and formatted output: Rightfacing arrow
Given two input integers for an arrowhead and arrow body, print a rightfacing arrow.
Ex: If the input is:
the output is:
import java.util.Scanner;
public class LabProgram
public static void mainString 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 mainString args
Scanner scnr new ScannerSystemin;
System.out.printEnter the base character: ;
char baseChar scanner.nextcharAt;
System.out.printEnter the head character: ;
char headChar scanner.nextcharAt;
System.out.println headChar;
System.out.println headChar headChar;
for int i ; i ; i
for int j ; j ; j
System.out.printbaseChar;
if i i
System.out.printlnheadChar headChar headChar;
else
System.out.printlnheadChar headChar headChar headChar;
System.out.println headChar headChar;
System.out.println headChar;
scanner.close;
I received the following errors:LabProgram.java:: error: cannot find symbol
char baseChar scanner.nextcharAt;
symbol: variable scanner
location: class LabProgram
LabProgram.java:: error: cannot find symbol
char headChar scanner.nextcharAt;
symbol: variable scanner
location: class LabProgram
LabProgram.java:: error: cannot find symbol
scanner.close;
symbol: variable scanner
location: class LabProgram
errors
Now I am ggetting the following: :Compare output
Output differs. See highlights below.
Special character legend
Input
Your output
Expected output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started