176k views
1 vote
Write a loop that asks the user "do you want to repeat the program or quit? (r/q)" . the loop should repeat until the user has entered an r or q (either uppercase or lowercase).

1 Answer

0 votes
Here is the loop:for (int i = 0; i < S.length(); i++) if (S.charAt(i) == 'R'
If the user enter any of the characters in the if statement the user will be asked by the question.
User Jegan
by
7.3k points