Unary Operators in Java
📖 Scenario: You are working on a simple Java program that helps a cashier calculate the number of items left after selling some. You will use unary operators to increase or decrease the count.
🎯 Goal: Build a Java program that uses unary operators to update the count of items sold and items left.
📋 What You'll Learn
Create an integer variable for the initial number of items
Create an integer variable for the number of items sold
Use unary operators to increase and decrease counts
Print the final count of items left
💡 Why This Matters
🌍 Real World
Cashiers and inventory managers often need to update counts quickly when items are sold or restocked.
💼 Career
Understanding unary operators helps in writing concise code for counters, loops, and state changes in many software jobs.
Progress0 / 4 steps