Computer Project
Computer Project
Computer Project
import java.util.*;
void accept()
Units=sc.nextInt();}
Float clacBill()
if(units <=50)
billAmt=units*2.25f;
billAmt= units*3.75f;
billAmt= units*5.25f;
billAmt=units*7.75;
else
billAmt= units*9.50f;
void display(){
obj.accept;
obj.calcBill();
obj.display();
}
PROGRAM :03
private int x;
private int y;
void accept()
x=2;
y=100;
obj.accept();
if(isPrime(i))
System.out.println(i);
}
}
int count = 0;
if (n < 2)
return false;
if (n % i == 0)
return false;
return true;
PROGRAM :04
import java.util.*;
{ private int n;
void accept()
n = sc.nextInt();
if (isKrishna(n))
else
{ int f = 1;
while (number != 0) {
f = f * number;
number--;
return f;
{ int sum = 0;
while (tempNumber != 0) {
} if(sum == number)
return true;
else
return false;
obj.accept();
}
PROGRAM :06
import java.util.*;
{ private int n;
while(n>1)
{ if(n%i==0)
{ sum=sum+findSumOfDigit(i);
n=n/i;
else
{ do
{ i++;
while(!isKrishna(i));
return sum;
{ int s=0;
while(n>0)
{ s=s+n%10;
n=n/10;
return s;
{
boolean b=true;
int d=2;
while(d<Math.sqrt(k))
if(k%d==0)
b=false;
d++;
return b;
void display()
int a = findSumOfDigit(n);
int b = findSumPrimeFactors(n);
if(a==b)
else
int n=sc.nextInt();
obj.display();
}
PROGRAM :07
import java.util.*;
class Words
static int n;
void accept()
n=sc.nextInt();
//aceppting words
for(int i=0;i<n;i++)
System.out.println("Enter a word");
w[i]=sc.next();
int readWords(String a)
int c=0;
int l=a.length();
a.charAt(l-1)=='u' )
c=1;
return c;
boolean checkVowel(String s)
if(readWords(s)== 1)
return true;
else
return false;
void display()
for(int i=0;i<n;i++)
if(checkVowel(w[i]=true))
ob.accept();
ob.readWords(w[n]);
ob.checkVowel(w[n]);
ob.display();
PROGRAM :09
import java.util.*;
{ private String w;
void readWord()
System.out.println("Enter a word");
w= sc.nextLine();
change(w.toCharArray());
}
static void change(char []w)
{ int n= w.length;
if (w[i] == 'a' ||w[i] == 'e' || w[i] == 'i' || w[i] == 'o' || w[i] == 'u')
for(char nw: w)
System.out.println(nw);
obj.readWord();
}
PROGRAM :10
import java.util.*;
void readSentence()
sent =sc.nextLine();
} void dispaly()
int i, j;
freq[i] = 1;
if(string[i] == string[j]) {
freq[i]++;
string[j] = '0';
} }
obj.display();
}}