Question: Re-type the code and fix any errors. The code should convert non-positive numbers to 1. if (userNum > 0) else System.out.println(Positive.); System.out.println(Non-positive, converting to

Re-type the code and fix any errors. The code should convert non-positive

Re-type the code and fix any errors. The code should convert non-positive numbers to 1. if (userNum > 0) else System.out.println("Positive."); System.out.println("Non-positive, converting to 1. "); userNum = 1; System.out.println("Final: + userNum); Common student error: Changing the order of the lines. You only need to fix the existing code. 1 import java.util.Scanner; 2 7689SSDWNA 3 public class ConvertNegative { 4 public static void main (String[] args) { Scanner scnr = new Scanner(System.in); int userNum; 5 10 11 TTT TIL 12 13 System.out.println("Non-positive, 14 56700 userNum = 1; 15 System.out.println("Final: 16 17 userNum scnr.nextInt (); if (userNum > 0) System.out.println("Positive."); 18 } else } converting to 1."); + userNum); /* Your solution goes here */

Step by Step Solution

3.45 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below Answer Here is the correcte... 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!