- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9326 Articles for Object Oriented Programming
801 Views
In this article, we will understand how to print a multiplication table. Multiplication table is created by iterating the required input 10 times using a for loop and multiplying the input value with numbers from 1 to 10 in each iteration.Below is a demonstration of the same −InputSuppose our input is −Input : 16OutputThe desired output would be −The multiplication table of 16 is : 16 * 1 = 16 16 * 2 = 32 16 * 3 = 48 16 * 4 = 64 16 * 5 = 80 16 * 6 = 96 16 * 7 = 112 ... Read More
248 Views
In this article, we will understand how to round a number to n decimal places. Rounding of decimal values are done using the CEIL or FLOOR functions.Below is a demonstration of the same −InputSuppose our input is −Input : 3.1415OutputThe desired output would be −Output : 3.2 AlgorithmStep 1 - START Step 2 - Declare a float variable values namely my_input. Step 3 - Read the required values from the user/ define the values Step 4 – Use the CEIL function to round the number to the required decimal places. In this example we are rounding up to 2 decimal ... Read More
2K+ Views
In this article, we will understand how to check the birthday and print Happy Birthday message. Checking the birthday is accomplished by comparing the present day and the given birthday.Below is a demonstration of the same −InputSuppose our input is −Birthday Date: 15 JulyOutputThe desired output would be −Today’s Date is 20-12-2021 Today is not my birthdayAlgorithmStep 1 - START Step 2 - Declare variables for month and dates values namely month_of_birth and date_of_birth Step 3 - Read the required values from the user/ define the values Step 4 - Use LocalDate.now() function to get the current date and store ... Read More
177 Views
In this article, we will understand how to iterate over enum objects. Enum is a datatype that represents a small collection of objects.Below is a demonstration of the same −InputSuppose our input is −Enum objects are defined as : red, blue, green, yellow, orangeOutputThe desired output would be −Printing the Objects: red blue green yellow orangeAlgorithmStep 1 – START Step 2 - Declare the objects of Enum function namely red, blue, green, yellow, orange Step 3 – Using a for loop, iterate over the objects of the enum function and print each object. Step 4- StopExample 1enum Enum { ... Read More
333 Views
In this article, we will understand how to check if two of three Boolean variables are true. Boolean variables are datatypes that can contain only true or false values.Below is a demonstration of the same −InputSuppose our input is −Input : true, true, falseOutputThe desired output would be −Result : Two of the three variables are trueAlgorithmStep 1 - START Step 2 - Declare 4 boolean values namely my_input_1, my_input_2, my_input_3 and my_result Step 3 - Read the required values from the user/ define the values Step 4 - Using an if-else condition, compare two of the three values each ... Read More
14K+ Views
In this article, we will understand how to implement multiple inheritance. Java does not support multiple inheritance. This means that a class cannot extend more than one class, but we can still achieve the result using the keyword 'extends'.Algorithm to Implement Multiple InheritanceStep 1 – START Step 2 – Declare three classes namely Server, connection and my_test Step 3 – Relate the classes with each other using 'extends' keyword Step-4 – Call the objects of each class from a main function. Step 5 – STOPExample 1class Server{ void my_frontend(){ System.out.println("Connection to frontend established successfully");} } ... Read More
2K+ Views
In this article, we will understand how to count the vowels and consonants in Java. Alphabets that include 'a' 'e' 'i' 'o' 'u' are called Vowels and all other alphabets are called Consonants.Below is a demonstration of the same −InputSuppose our input is −Hello, my name is CharlieOutputThe desired output would be −The number of vowels in the statement is: 8 The number of vowels in the Consonants is: 12AlgorithmStep1- Start Step 2- Declare two integers: vowels_count, consonants_count and a string my_str Step 3- Prompt the user to enter a string value/ define the string Step 4- Read the values ... Read More
737 Views
In this article, we will understand how to compute the quotient and reminder in Java. Quotient and Reminder is calculated using two simple formula "Quotient = Dividend / Divisor" and "Remainder = Dividend % Divisor".Given an integer a and a non-zero integer d, it can be shown that there exist unique integers q and r, such that a = qd + r and 0 ≤ r < |d|. The number q is called the quotient, while r is called the remainder.Below is a demonstration of the same −InputSuppose our input is −Dividend value: 50 Divisor: 3OutputThe desired output would be ... Read More
925 Views
In this article, we will understand how to print ascii values of characters. This is done by assigning the character to an integer value and printing those integer values.ASCII stands for American Standard Code for Information Interchange. There are 128 standard ASCII codes, each of which can be represented by a 7-digit binary number: 0000000 through 1111111. Extended ASCII adds an additional 128 characters that vary between computers, programs and fonts.Below is a demonstration of the same −InputSuppose our input is −Enter a character: sOutputThe desired output would be −Ascii value of s is 115 AlgorithmStep1- Start Step 2- Declare ... Read More
424 Views
In this article, we will understand how to convert decimal to octal. a Decimal number is a number whose whole number part and the fractional part is separated by a decimal point. Octal Number has a base of eight and uses the number from 0 to 7.Below is a demonstration of the same −InputSuppose our input is −Enter the decimal number : 8OutputThe desired output would be −The octal value is 10AlgorithmStep 1 - START Step 2 - Declare three integer value namely my_input, I and j and an integer array my_octal Step 3 - Read the required values from ... Read More