Year: 2017
-
JAVA program to accomplish task using string/string Buffer class
Write a program to Implement a program to accomplish the following task using string/string Buffer class: i. Accept a password from the user. ii. Check if password is correct then display “Good” Else display “Incorrect password” iii. Append the password with the string “Welcome to Java!!!” iv. Display the password in reverse order. v. Replace…
-
Accept a string from the console and count number of vowels, constants, digits, tabs and blank spaces in a string.
Write a program to accept a string from the console and count number of vowels, constants, digits, tabs and blank spaces in a string. import java.io.*; class q5vowels { public static void main(String args[]) throws IOException { String str; int vowels = 0, digits = 0, blanks = 0; char ch; BufferedReader br = new…
-
Define a class Employee to accept emp_id, emp _name, basic_salary from the user and display the gross_salary.
Write a program to define a class Employee to accept emp_id, emp _name, basic_salary from the user and display the gross_salary. import java.lang.*; import java.io.*; class Employee { int emp_id; String emp_name; float basic_salary; Employee(int id, String name, float sal) { emp_id=id; emp_name=name; basic_salary=sal; } void display() { float da=basic_salary*15/100; float hra=basic_salary*10/100; float gross_sal=basic_salary+da+hra; System.out.println…
-
Java Class Fraction Operations / Numerator and Denominator / Initialize Objects using Constructors
Write a program to define a class Fraction having data members numerator and denominator. Initialize three objects using different constructors and display its fractional value. import java.lang.*; import java.io.*; class Fraction { double numerator,denominator,fraction; Fraction (int a, double b) { numerator=a; denominator=b; fraction=numerator/denominator; System.out.println (“Fraction1 = “+fraction); } Fraction (int x, int y) { numerator=x;…
-
Student Class / Data Members / Initialize / Display Data Values and Calculate Students Marks
Write a program to define a class student with four data members such as name, roll no., sub1, and sub2. Define appropriate methods to initialize and display the values of data members. Also, calculate total Marks and percentage scored by the student. import java.lang.*; import java.io.*; class student { String name; int roll_no; int sub1,sub2;…
-
JAVA class with a 3 digit number data member and it’s initialize to display reverse
Write a program to define a class having one 3-digit number, a ‘num’ as a data member. Initialize and display reverse of that number. import java.lang.*; class q1Reverse { int num,r=0,s=0; q1Reverse(int n) { num = n; } void Reverse() { while(num>0) { r=num%10; s=(s*10)+r; num=num/10; } System.out.println(“Reverse of number =”+s); } public static void main(String…
-

WannaCry Infected Sites of Nepal – Be Alert: Ransomware Hits Nepal
Here is a list of the Nepalese sites which are infected by Ransomware known as WannaCry. Please do not visit this site for testing also. The most deadly ransomware worm known as WannaCrypt, WannaCry, WannaCrypt0r, WCryptor or WCRY has also attacked the Nepalese internet infecting thousands of devices and affecting more than a hundred countries.…
-

5 Reasons Bahubali 2 was Success in Nepal
Bahubali 2 (Nepali: बाहुबली द्वितीय), a South Indian movie has set a new record in Nepal. Among all other Bollywood movies, Bahubali 2 was able to generate more revenue and winning the hearts of Nepali viewers. The Gopi Krishna Movies, the official movie distributor for Nepal told, “The opening record breaker movie Bahubali-2 in Nepal…
-

Celebrate Buddha Jayanti 2074 // Buddha’s Birthday 2017
I wish you every good soul a very Happy Buddha Jayanti also known as Buddha Purnima. It’s a great day for us Nepalese. It’s our pride that such a great person was born in our country Nepal at Lumbini. Every day I wish Buddha teachings to be shared with millions of people out there as I…
-
JAVA Inheritance With Concept and Examples / Output
PROGRAM STATEMENT Design a super class called Staff with details as StaffId, Name, Phone, Salary. Extend this class by writing three subclasses namely Teaching (domain, publications), Technical (skills), and Contract (period). Write a Java program to read and display at least 3 staff objects of all three categories. CONCEPT [alert-announce]Here in this given problem we…
-

Stack using arrays / Push(), Pop(), and Display() methods in JAVA Programming Language
PROGRAM STATEMENT Write a Java program to implement the Stack using arrays. Write Push(), Pop(), and Display() methods to demonstrate their working. CONCEPT [alert-announce]In Java everything is encapsulated under classes. The class is the core of Java language. The class can be defined as a template/ blueprint that describes the behaviours/states of a particular entity.…
-
Creating a Java Class with Variable (Program Statement+Concepts+Sample Programs+Output)
PROGRAM STATEMENT Create a Java class called Student with the following details as variables within it. (i) USN (ii) Name (iii) Branch (iv) Phone Write a Java program to create nStudent objects and print the USN, Name, Branch, and Phone of these objects with suitable headings. CONCEPT In Java, everything is encapsulated under classes. Class…

