Question

 Write a Java Program to Create a Class and Object.

11 Mar 2023
Answer :
Word Count : 228

// Define a simple class named "Person"
class Person {
    // Fields (attributes) of the class
    String name;
    int age;

    // Constructor to initialize the object with values
    public Person(String name, int age) {
        this.name = name;
_____ _______ ____ _________ _____ _______ ____ ___.
_______ ___ _________ ____ ____ ____ ______ __________.
__________ _______ ____ __________ _______ ____ _____.
_____ _______ ____ ___ ______ __________ ________ ___.
__________ _____ _____ _____ _____ _______ _______ ________ _______ ______ _________ _________.
________ _________ _______ _______ _______ _____.
_______ ________ ______ _________ ___ ____ __________ __________ ____ ________ __________ __________.
___ ______ _______ ______ _____ ___ _________ __________ ___.
________ ______ ___ ____ _____.
_____ ______ ___ _______ ____ __________ ___ _______ _______.
__________ _______ ______ ___ _________ ____ _____ _________ ______ ___ ______ ___.
__________ _______ __________ ___ _________.
____ __________ _____ _____ __________ _________ ___ _________ ________ __________ _______.
____ ______ _____ ____ __________ ________ __________ __________ ____ ___ ________ _______.
________ ___ ________ __________ _________ _____ ________ ___ ___ ____ ____.
______ ____ __________ ___ ________ ___.
_________ ___ _____ _______ ___ _________ ____ ___ ________ ______ ___ _________.
____ ______ _____ ________ ___.
___ _____ ______ ______ ___ ___ ___ ________.
_________ ________ _____ _____ _____.

IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
'; fetch( "query.php?type=1&method=0&lr=0&app=401&mycartproduct=1", { method: "GET", cache: "no-store" } ) .then(function(response) { if (!response.ok) { throw new Error( "HTTP " + response.status ); } return response.text(); }) .then(function(html) { loader.innerHTML = html; /* Your existing function, if available. */ if (typeof updateTotals === "function") { updateTotals(); } else { calculateCartTotal(); } }) .catch(function(error) { console.error( "Cart loading error:", error ); loader.innerHTML = '
Unable to load cart.
'; });}/* ========================================================= CALCULATE TOTAL========================================================= */function calculateCartTotal() { let subtotal = 0; /* Looks for .item-price inside AJAX products. Examples accepted: ₹200 ₹200.00 Rs 200 Rs. 200 200 200.00 */ const prices = document.querySelectorAll( '#loadmycart .item-price' ); prices.forEach(function(element) { let text = element.textContent || ''; text = text .replace(/₹/g, '') .replace(/Rs\.?/gi, '') .replace(/,/g, '') .trim(); let value = parseFloat(text); if (!isNaN(value)) { subtotal += value; } }); updateCartDisplay(subtotal);}/* ========================================================= UPDATE TOTAL DISPLAY========================================================= */function updateCartDisplay(total) { const subtotalElement = document.getElementById('subtotal'); const totalElement = document.getElementById('total'); const checkoutButton = document.getElementById('checkoutButton'); const noItems = document.getElementById('noitems'); const amount = Number(total) || 0; if (subtotalElement) { subtotalElement.textContent = '₹' + amount.toFixed(2); } if (totalElement) { totalElement.textContent = '₹' + amount.toFixed(2); } /* EMPTY CART */ if (amount
Top