Xii-Icse: Computer Project
Xii-Icse: Computer Project
XII-ICSE
Computer Project
MADE BY:
ADITYA NAUTIYAL
Certificate
This is to certify that Aditya Nautiyal of Class X has prepared
this project under guidance of Mr Sachin Gairola (Subject
Teacher). This project of Computers’ has been prepared
following the guideline within syllabus of ICSE.
Program 30:Program that will add 10% tax to the bill amount
class clb
{public void AddTax(int billamo)
{billamo=billamo+(billamo*10/100);
System.out.println(“total bill amount after adding tax is: “ +billamo);
}
public static void main(String args[])
{
clb ob=new clb();
int billmo=1200;
System.out.println(“Basic bill amount is:” +billmo);
ob.addtax(biilmo);
}}
OUTPUT:
Basic bill amount is:1200
total bill amount after adding tax is:1320
}
public static void main(String[] args)
{
Test obj = new Test();
}}
OUTPUT:
12345
PROGRAM 36:to convert temperature from Celsius to Fahrenheit and vice versa
import java.util.*;
class temperature
{
public static void main(String s[])
{
Scanner k=new Scanner(System.in);
System.out.print("enter choice 1 for C to F and 2 for F to C");
int ch=k.nextInt();
System.out.println("enter temperature");
double t=k.nextDouble();
switch(ch) //choice
{
case 1: //fahrenheit
double f=(9*t)/5+32;
System.out.print(f);
break;
case 2: //celsius
double c=(5*t-160)/9;
System.out.print(c);
break;
}
}
}
OUTPUT:
enter choice 1 for C to F and 2 for F to C
2
enter temperature
108
42.22222222222222
Program 49: to print row and column with array and printing highest value from them
public class arr10
{ public static void main()
{ String n[]={"A","B","C","D","E"};
int p[]={10, 15, 18, 12, 25};
int c[]={20, 15, 22, 23, 12};
int m[]={25, 25, 20, 10, 18};
int h=0;
String s="";
for(int i=0; i<n.length; i++)
{ int t=p[i]+c[i]+m[i];
if(t>h)
{ h=t;
s=n[i];
}
System.out.println(n[i]+" "+p[i]+" "+c[i]+" "+m[i]+" "+t);
}
System.out.println("Highest= "+h+" of "+s);
}
}
OUTPUT:
A 10 20 25 55
B 15 15 25 55
C 18 22 20 60
D 12 23 10 45
E 25 12 18 55
Highest= 60 of C
PROGRAM 52:to store vowels of a string at the end and consonants in the beginning without changing its
order
import java.util.*; // importing util package
class string2
{
public static void main(String s[])
{
Scanner k=new Scanner(System.in); // creating object of Scanner class
System.out.println("enter a word");
String str=kb..nextLine(); // storing string entered by user
String s1="";
String s2="";
for(int i=0;i<str.length();i++)
{
char ch=str.charAt(i);
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U') // arranging vowel
s1=s1+ch;
else
s2=s2+ch; // arranging consonant
}
String str1=s2+s1; //storing consonants first and vowels at last
System.out.print(str1);
}
}
OUTPUT:
enter a word
dehRAdUn
dhRdneAU
class string8
{
public static void main(String s[])
{
Scanner kb=new Scanner(System.in);
System.out.println("enter a 3 word name");
String str=kb.nextLine();//storing name
str=str+" ";
String s1="";
s1=s1+str.charAt(0);int c=0;
for(int i=1;i<str.length();i++)
{if(str.charAt(i)==' ')//finding space
{c++;
if(c==1)
{s1=s1+"."+str.charAt(i+1)+".";}//storing second initial
else
{s1=s1+str.substring(i+1);break;}//storing last word
}
}
System.out.print(s1);
}
}
OUTPUT:
enter a 3 word name
Amey Prakash Sati
A.P.Sati
PROGRAM 59:to change each vowel with next vowel an each digit with next digit
import java.util.*;
class string9
{
public static void main(String s[])
{
Scanner kb=new Scanner(System.in);
System.out.println("enter a string");
String str=kb.nextLine();
String sc="aeiou0123456789";
String ch="eioua1234567890";
String disp="";
str=str.toLowerCase();
for(int i=0;i<str.length();i++)
{int j=sc.indexOf(str.charAt(i));
if(j>=0) //checking if we have it in sc
{disp=disp+ch.charAt(j);} //changing character
else
{disp=disp+str.charAt(i);}
}
System.out.println(disp);
}
}
OUTPUT:
enter a string
name Aditya roll no. 12
nemi edotye rull nu. 23