🔥 Title Solved "Library Fine" Problem Using Java 📚💻 📄 Description I recently worked on the Library Fine problem, a great exercise to strengthen conditional logic and real-world problem-solving. 🔍 Problem Summary: Calculate the fine for returning a library book late based on: Days late Months late Years late 💡 Approach: Compare return date with due date Apply fine rules based on hierarchy (year → month → day) Ensure minimum penalty logic is followed ✨ Key Learning: Breaking down conditions step-by-step helps avoid logical errors and improves clarity in coding. ⚡ Implemented in Java with simple and efficient conditional checks. 🏷️ Tags #Java #DSA #Coding #ProblemSolving #HackerRank
Solved Library Fine Problem in Java
More Relevant Posts
-
🚀 Day 2 – Practicing Loops in Java (DSA Journey) Today, I focused on solving some interesting problems based on loops in Java, and it really helped me understand how logic works in programming. These questions were simple but very powerful in building problem-solving skills. 👉 I started with a question where I had to figure out how many times "Hello" would be printed in a loop. At first, it looked easy, but when I noticed the increment inside the loop, it made me think deeper about how loops actually execute step by step. This taught me the importance of carefully analyzing code rather than just assuming the output. 📘 Loops Questions (Short & Sequential) Q1. How many times will "Hello" be printed in the given loop? Q2. Write a program to calculate the sum of even and odd numbers from a set of integers. Q3. Write a program to find the factorial of a number (n!) entered by the user. Q4. Write a program to print the multiplication table of a number (N). Q5. Identify the error in the given program and explain what is wrong. Overall, today’s practice made me more confident in using loops and understanding how they work internally. I realized that even small problems can teach big concepts if we focus on logic. #DSA #Java #CodingJourney #ApnaCollege #Learning #Consistency
To view or add a comment, sign in
-
🚀 Day 8 – Understanding Functions and Parameters in Java Today, I learned about functions (methods) in Java, which are very important for writing clean and reusable code. A function is simply a block of code that performs a specific task and can be used multiple times in a program. This helps to reduce repetition and makes the code easier to understand. I started by learning the basic syntax of a function, where we define a return type, function name, and body. Then I moved to functions with parameters, where values are passed into the function to perform operations. This made the concept more practical. Next, I learned about types of parameters: Formal Parameters: These are variables defined in the function. Actual Parameters: These are the values passed when calling the function. 👉 Understanding this difference made it clear how data flows inside a program. Overall, today’s learning helped me understand how to write better and more structured code using functions. 💪 I will keep practicing daily and improve step by step in my coding journey. #Java #Coding #DSA #Learning #Consistency
To view or add a comment, sign in
-
-
Day 33 of Learning Java Today I learned about Return Types in Java methods, and it finally started to make sense how methods give results back! Here’s what I understood: 🔹 Every method has a return type 🔹 It tells what kind of value the method will give back 🔹 There are mainly two types: Primitive Data Types (PDT) : • byte • short • int • long • char • String • float • double • boolean Reference Data Types (RDT) : • Arrays • Classes • Interfaces • Annotations • Enums 🔹 A method can also return an object 🔹 The "return" keyword is used to send the value back 🔹 If nothing is returned, we use "void" Thanks to my mentor Ashim Prem Mahto for the clear explanations and for always clearing my doubts. #Java #LearningJava #ProgrammingJourney #CodingLife #JavaBasics #SoftwareDevelopment #DeveloperJourney #TechLearning #StudentLife
To view or add a comment, sign in
-
-
🚀 Back with another update from my Java + DSA journey! Staying consistent and focusing on building strong fundamentals 💪 Today I explored some core Java concepts: • Variable Shadowing Local variable hides class variable depending on scope • Static vs Non-Static Static → belongs to class (no object needed) Non-static → belongs to object (object required) • Variable Arguments (Varargs) Allows flexible number of inputs Fixed parameters come first, varargs must be last • Method Overloading Same method name, different parameters Java decides based on number/type of arguments 💡 Key takeaway: Understanding scope and function behavior makes coding much clearer. Small concepts, strong foundation 🔥 Let’s keep learning 🚀 #Day2 #Java #DSA #LearningInPublic #Consistency #CodingJourney
To view or add a comment, sign in
-
-
Exploring one of the most powerful concepts in Java — Polymorphism, and I achieved it using Inheritance with a simple Plane program. In Java, polymorphism allows a single object to take multiple forms. Using inheritance and method overriding, I implemented a Plane example where different types of planes (like Cargo Plane and Passenger Plane) show different behaviors even though they share a common parent class. It was really interesting to see how a parent class reference can call different implementations at runtime — making the program dynamic and flexible. A big thank you to TAP Academy for teaching this concept so clearly and effortlessly. The real-time examples, like the Plane program, made it much easier to understand how inheritance and polymorphism work together. Excited to apply these concepts in real-world projects and keep growing 🚀 #Java #OOP #Polymorphism #Inheritance #CodingJourney #Learning #SoftwareDevelopment #TAPAcademy
To view or add a comment, sign in
-
🚀 **Day 4 of My DSA Journey in Java** Today, I took my first real step into writing Java programs and understanding how code actually works behind the scenes. 🔹 Learned about **functions/methods** — reusable blocks of code designed to perform specific tasks, along with the concept of input and output. 🔹 Understood the importance of the **main() function** — the entry point where every Java program begins execution. 🔹 Wrote my first **Hello World program** using `System.out.println()` 🎉 🔹 Explored the difference between `print` and `println` for output formatting. 🔹 Learned how to use **comments** (`//` and `/* */`) to make code more readable and maintainable. 🔹 Got introduced to the structure of classical Java syntax like `public static void main`. One key takeaway: not everything needs to be mastered instantly — some concepts are okay to understand at a basic level now and explore deeply later. Slowly building consistency and strengthening my fundamentals 💻✨ #DSA #Java #LearningJourney #Coding #Programming #Beginners #Consistency
To view or add a comment, sign in
-
🚀 Day 13 – Decimal to Binary Conversion & Scope in Java Today, I learned how to convert a decimal number into a binary number and also understood the concept of scope in Java. First, I studied the method of converting decimal to binary using repeated division by 2. For example, when converting the number 7, we divide it by 2 continuously and note the remainders. When we read the remainders in reverse order, we get the binary value (111). This method helped me clearly understand how binary numbers are formed. I also learned the logic behind writing this program using a while loop. In each iteration, we divide the number by 2, store the remainder, and increase the power value. This step-by-step process makes it easy to convert any decimal number into binary using code. Next, I revised the concept of scope, which tells where a variable can be accessed in a program. I learned about method scope, where variables declared inside a method can only be used within that method. Then, I understood block scope, where variables declared inside a block (like inside curly braces {}) are limited only to that block. I also saw examples showing correct and incorrect usage of variables, which made the concept much clearer. 💪 I will continue practicing daily and improve step by step. #Java #DSA #CodingJourney #Learning #Consistency
To view or add a comment, sign in
-
-
🚀 Day 48 of My Java Learning Journey Today, I explored one of the most important concepts in Java – Collection Framework 💡 📌 What I Learned: Collection Framework is a set of classes and interfaces used to store and manipulate data efficiently It was introduced in JDK 1.2 by Josh Bloch Acts as an alternative to Data Structures in Java 📊 Key Components: Interfaces → List, Set, Queue, Map Classes → ArrayList, LinkedList, HashSet, HashMap 🔥 Why Collections? ✔ Dynamic size (no fixed length like arrays) ✔ Inbuilt methods (add, remove, etc.) ✔ Efficient data handling ✔ Reduces coding effort 💻 Key Features: Allows heterogeneous data Maintains insertion order (List) Allows duplicates (List) Improves performance in real-world applications 📈 Takeaway: Collection Framework is a must-know concept for interviews and real-time development. Almost every Java application uses it! #Day48 #Java #CollectionsFramework #JavaDeveloper #LearningJourney #Coding #Programming
To view or add a comment, sign in
-
-
🔥 Title Cracked the "Counting Valleys" Problem Using Java 🚀 📄 Description I recently solved the Counting Valleys problem, a popular coding question that tests logic building and problem-solving skills. 🔍 Problem Insight: A valley is a sequence of steps below sea level, starting with a downhill and ending with an uphill. 💡 Approach: Track the altitude level Increase for 'U' and decrease for 'D' Count a valley whenever we return to sea level from below ✨ Key Learning: Understanding how to track state changes (altitude) efficiently can simplify many real-world problems. #Java #DSA #ProblemSolving #Coding #HackerRank
To view or add a comment, sign in
-
-
🚀 Day 39/45 – Learning File Handling in Java 📂 Today I explored File Handling in Java, which allows us to store and manage data permanently using files. 📚 What I Learned: ✔ Creating files using File class ✔ Writing data using FileWriter ✔ Reading files using FileReader ✔ Efficient reading using BufferedReader ✔ Deleting files in Java 💻 Practice Work: • Created and managed text files • Performed read/write operations • Practiced real-world file-based scenarios 🎯 Key Takeaway: File Handling is essential for building real-world applications where data persistence is required. #Java #FileHandling #Programming #CodingJourney #LearningInPublic #BackendDevelopment
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development