Instructions are on the left in the included pictures below and the program that's already been started is in the middle

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Instructions are on the left in the included pictures below and the program that's already been started is in the middle

Post by answerhappygod »

Instructions are on the left in the included pictures belowand the program that's already been started is in the middlesection of the pictures. Please read the instructions and get thecorrect output, I'll make sure to like correct responses.
Instructions Are On The Left In The Included Pictures Below And The Program That S Already Been Started Is In The Middle 1
Instructions Are On The Left In The Included Pictures Below And The Program That S Already Been Started Is In The Middle 1 (125.78 KiB) Viewed 33 times
Instructions Are On The Left In The Included Pictures Below And The Program That S Already Been Started Is In The Middle 2
Instructions Are On The Left In The Included Pictures Below And The Program That S Already Been Started Is In The Middle 2 (105.78 KiB) Viewed 33 times
Accumulating Totals in a Loop in Java 0 Accumulating Totals in a Loop ✓= bl E Ⓡ Summary In this lab, you add a loop and the statements that make up the loop body to a Java program that is provided. When completed, the program should calculate two totals: the number of left-handed people and the number of right- handed people in your class. Your loop should execute until the user enters the character X instead of L for left-handed or R for right- handed. The inputs for this program are as follows: R. R, R, L, L, L, R, L, R, R. L. X Variables have been declared for you, and the input and output statements have been written. LeftOrRight.java 1 // LeftorRight.java - This program calculates the total number of left-handed and right-hand 2 // students in a class. 3 // Input: L for left-handed; R for right handed; X to quit. 4 // Output: Prints the number of left-handed students and the number of right-handed students 5 6 import java.util.Scanner; 7 8 public class LeftOrRight 9 { 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 public static void main(String args[]) { Scanner s = new Scanner(System.in); String leftorRight = ""; // L or R for one student. // Number of right-handed students. // Number of left-handed students. int rightTotal = 0; int leftTotal = 0; // This is the work done in the housekeeping() method System.out.println("Enter L if you are left-handed, R if you are right-handed or X leftOrRight = s.nextLine(); // This is the work done in the detailLoop() method // Write your loop here. Ⓡ // This is the work done in the endOf Job() method // Output number of left or right-handed students. System.out.println("Number of left-handed students: " + leftTotal); System.out.println("Number of right-handed students: " + rightTotal); System.exit(0);
Accumulating Totals in a Loop in Java ✓= L Accumulating Totals in a Loop www.sop w follows: R, R, R, L, L, L, R, L, R, R, L, X Variables have been declared for you, and the input and output statements have been written. Instructions 1. Ensure the file named LeftOrRight.java is open. 2. Write a loop and a loop body that allows you to calculate a total of left-handed and right- handed people in your class. 3. Execute the program by clicking Run and using the data listed above and verify that the output is correct. LeftOrRight.java 6 ava.util.Scanner; 7 8:lass LeftOrRight 9 10.ic static void main(String args[]) 11 12 Scanner s = new Scanner(System.in); 13 String leftorRight = ""; // L or R for one student. 14 int rightTotal = 0; // Number of right-handed students. 15 int leftTotal = 0; // Number of left-handed students. 16 17 // This is the work done in the housekeeping() method 18 System.out.println("Enter L if you are left-handed, R if you are right-handed or X to quit. 19 leftorRight = s.nextLine(); 20 21 // This is the work done in the detailLoop() method 22 // Write your loop here. 23 24 25 26 // This is the work done in the endOfJob() method 27 // Output number of left or right-handed students. 28 System.out.println("Number of left-handed students: "+ left Total); 29 System.out.println("Number of right-handed students: " + rightTotal); 30 System.exit(0); 31 End of main() method. 32 331 of LeftOrRight class. 34 35
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply