Operating System Structures

An operating system is a construct that allows the user application programs to interact with the system hardware. Since the operating system is such a complex structure, it should be created with utmost care so it can be used and modified easily. An easy way to do this is to create the operating system in … Continue reading Operating System Structures

List ADT

Program: #include<stdio.h> #include<conio.h> #define MAX 10 void create(); void search(); void traverse(); int a,b[20], n, p, e, f, i, pos; void main() { int ch; char g='y'; clrscr(); do { printf("\n Main Menu"); printf("\n 1.Create \n 2.Search \n 3.Traverse \n 4.Exit"); printf("\n Enter your Choice: "); scanf("%d", &ch); switch(ch) { case 1: create(); break; case … Continue reading List ADT

Program

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

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.