Question: Write a program that solves the following problem that combines use of Loops, String, and StringBuilder. There's a multiple - choice test with N questions,
Write a program that solves the following problem that combines use of Loops, String, and StringBuilder.
There's a multiplechoice test with N questions, numbered from to N Each question has answer options, labelled A and B You know that the correct answer for the ith question is the ith character in the string C which is either A or B but you want to get a score of on this test by answering every question incorrectly.
Your task is to implement the conversion which prints a string with N characters, the ith of which is the answer you should give for question i in order to get it wrong either A or BImplement this using a StringBuilder object but print the String value of it
Example:
C ABA
N
Expected Output BAB
C BBBBB
N
Expected Output AAAAA
import java.util.Scanner;
class Solution
public static void mainString args
Scanner scnr new ScannerSystemin;
String c scnrnext;
StringBuilder output;
Your code to convert the strings here
System.out.printlnc converts to outputtoString;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
