In Java please.

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

In Java please.

Post by answerhappygod »

In Java please.
In Java Please 1
In Java Please 1 (54.05 KiB) Viewed 22 times
CHALLENGE ACTIVITY 3.8.1: If-else statement: Fix errors. Re-type the code and fix any errors. The code should convert non-positive numbers to 1. if (userNum > 0) System.out.println("Positive."); else 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. 373350.1838896.qx3zqy7 test passed 1 import java.util.Scanner; 2 3 public class ConvertNegative { public static void main (string [] args) { 5 Scanner scnr = new Scanner(System.in); int userNum; 4 All tests passed 6 7 8 userNum = scnr.nextInt(); V* Your solution goes here */ 99uum 10 11 12 13 } } Run
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply