import java.util.Scanner; import java.text.DecimalFormat; public class MobileBill { public static void main(String[]args){ final double lcalls = 0.10; final double icalls = 1.00; final double net = 500.00; double localcalls, ISDcalls, totallocalcalls, totalISDcalls, netbill, totalnetbill,totalbill; Scanner keyboard = new Scanner(System.in); DecimalFormat df = new DecimalFormat("0.00"); System.out.println("Please Enter your local calls in minutes: "); localcalls = keyboard.nextDouble(); … Continue reading Program
Uncategorized
Write a java program to find the factorial of a number using interface concept.
Program: import java.util.Scanner; public class Main { //Driver Code public static void main(String[] args) { //Take input from the user Scanner sc = new Scanner(System.in); System.out.println("Enter the number :"); int num = sc.nextInt(); //Input the number if(num>=0) { //Call a recursive function to find the factorial int factorial=findFactorial(num); System.out.println("The factorial of the entered number is … Continue reading Write a java program to find the factorial of a number using interface concept.
Write a Java Program to create an abstract class named Shape that contains two integers andan empty method named printArea(). Provide three classes named Rectangle, Triangle andCircle such that each one of the classes extends the class Shape. Each one of the classescontains only the method printArea() that prints the area of the given shape.
Program: import java.util.*; abstract class shape { int x,y; abstract void area(double x,double y); } class Rectangle extends shape { void area(double x,double y) { System.out.println("Area of rectangle is :"+(x*y)); } } class Circle extends shape { void area(double x,double y) { System.out.println("Area of circle is :"+(3.14*x*x)); } } class Triangle extends shape { void … Continue reading Write a Java Program to create an abstract class named Shape that contains two integers andan empty method named printArea(). Provide three classes named Rectangle, Triangle andCircle such that each one of the classes extends the class Shape. Each one of the classescontains only the method printArea() that prints the area of the given shape.
Write a Java program that keeps a number from the user and generates an integer between 1 and 7and displays the name of the weekday.Test DataInput number: 3Expected Output :Wednesday
Program: import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Input number: "); int day = in.nextInt(); System.out.println(getDayName(day)); } // Get the name for the Week public static String getDayName(int day) { String dayName = ""; switch (day) { case 1: dayName = "Monday"; break; case 2: … Continue reading Write a Java program that keeps a number from the user and generates an integer between 1 and 7and displays the name of the weekday.Test DataInput number: 3Expected Output :Wednesday
Write a java program that implements a multi-threaded application that has three threads. First thread generates a random integer every 5 second and if the value is prime, second thread computesthe square of the number and prints and if the value is odd, the third thread will print the value of cube of the number.
Program: import java.util.Random; class Square extends Thread { int x; Square(int n) { x = n; } public void run() { int sqr = x * x; System.out.println(“Square of ” + x + ” = ” + sqr ); } } class Cube extends Thread { int x; Cube(int n) {x = n; } public … Continue reading Write a java program that implements a multi-threaded application that has three threads. First thread generates a random integer every 5 second and if the value is prime, second thread computesthe square of the number and prints and if the value is odd, the third thread will print the value of cube of the number.
How Mobile Network works
Different Patterns of cell tower Mostly Circular pattern is not used because dead zone appear in circular pattern Most used pattern Hexagonal Pattern is mostly used pattern Mobile Tower in Early Stage Mobile Tower Range is 50 kms Nowadays Mobile Tower Mobile Tower Range varies how many users in that range Working of Mobile Network … Continue reading How Mobile Network works
Polymer Memory
Semiconductor memory is a digital electronic semiconductor device used for digital data storage, such as computer memory, where data is stored within metal–oxide–semiconductor (MOS) memory cells on a silicon integrated circuit memory chip. Silicon Shortage A metal made from the second-most abundant element on Earth has become scarce, threatening everything from car parts to computer chips … Continue reading Polymer Memory
REPRESENT A POLYNOMIAL AS A LINKED LIST
Algorithm: 1: Get the two polynomials. First polynomial is P1 and second polynomial is P22: For addition of two polynomials if exponents of both the polynomials are same then we adthe coefficients. For storing the result we will create the third linked lists say P3.3: If Exponent of P2 is greater than exponent of P1 … Continue reading REPRESENT A POLYNOMIAL AS A LINKED LIST
QUEUE ADT USING LINKED LIST
Algorithm: Define a struct for each node in the queue. Each node in the queuecontains data and link to the next node. Front and rear pointer points to first andlast node inserted in the queue.The operations on the queue area. INSERT data into the queueb. DELETE data out of queueINSERT DATA INTO queuea. Enter the … Continue reading QUEUE ADT USING LINKED LIST
STACK ADT USING LINKED LIST
Algorithm: Define a struct for each node in the stack. Each node in the stack contains data andlink to the next node. TOP pointer points to last node inserted in the stack.The operations on the stack area. PUSH data into the stackb. POP data out of stackPUSH DATA INTO STACKa. Enter the data to be … Continue reading STACK ADT USING LINKED LIST