Question: In this lab, you add a loop and the statements that make up the loop body to a Java program provided. When completed, the program
In this lab, you add a loop and the statements that make up the loop body to a Java program provided. When completed, the program should calculate two totals: the number of lefthanded people and the number of righthanded people in your class. Your loop should execute until the user enters the character X instead of an L for lefthanded or an R for righthanded.
import javax.swing.JOptionPane;
public class LeftOrRight
public static void mainString args
String leftOrRight ; L or R for one student.
int rightTotal ; Number of righthanded students.
int leftTotal ; Number of lefthanded students.
leftOrRight JOptionPane.showInputDialogEnter L if you are lefthanded, R if you are righthanded or X to quit.";
Write your loop here.
Output number of left or righthanded students.
System.out.printlnNumber of lefthanded students: leftTotal;
System.out.printlnNumber of righthanded students: rightTotal;
End of LeftOrRight class.
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
