Question: Write code that outputs variable numPants as follows. End with a newline. Ex: If the input is: 4 the output is: There were 4

Write code that outputs variable numPants as follows. End with a newline. 

Write code that outputs variable numPants as follows. End with a newline. Ex: If the input is: 4 the output is: There were 4 pants. 1 import java.util.Scanner; LEAFTE22 3 public class OutputTest { 6 8 9 10 11 12 13 public static void main (String [] args) { int numPants; // Our tests will run your program with input 4, then run again // Your program should work for any input, though. Scanner scnr = new Scanner (System.in); numPants = scnr.nextInt(); System.out.println("There were 7 pants.");

Step by Step Solution

3.36 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Step 11 import javautilScanner public class OutputTest public static void ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!