Priya's Java Project Work
Priya's Java Project Work
Xth B, 31
1
I would like to express
my special thanks of
gratitude to my computer
teacher Mrs Payal who
gave me the golden
opportunity to do this
wonderful project of
“JAVA SCRIPT “and
helped me in completing
my project.I came tp
know about many new
things I am really very
thankful to her.Secondly, I
would like to thank my parents and friends who helped me a lot in
finalizing this project within the limited time frame.
Priya Jaswal
Xth B
2
S.NO Programmes Page Remarks
No.
1. W.A.P. to input a sentence and 5
convert it into uppercase and count
and display the total number of
words starting with letter ‘A’.
2. A tech number has a even number of 6
digits if the number is split into two
equal halves, then the square of sum
of these two halves is equal to the
number itself. Write a program to
generate and print all 4 digit tech
number.
3. W.A.P. to input a number and check 7
and print whether it is a Pronic
number or not.
4. W.A.P. to input 15 integer elements 8-9
in an array and sort them in
ascending order using the bubble
sort technique.
5. Using the switch case statement 10-11
write a menu driven program to do
the following:
PATTERN 1 PATTERN 2
ABCDE B
ABCD LL
ABC UUU
AB EEEE
A JJJJJ
6. Design a class to overload a function 12-13
series () as follows:
a)void series(int x,int n)-To display
the sum of the series given below:
x1 +x2+x3…….xn terms
b)void
b)void series(int p)- To display the
following series:
0,7,20,63……..p terms
c)void series()- To display the sum of
series given below:
1 1 1 1
+ +
2 3 4 +………. 10
7. i)Write
i)Write a class called Rectangle with 14-15
3
two float data numbers. Write a
default and a parameterized
constructor for the class to initialize
the data members. Write the main()
function to invoke both of them.
ii)Write
ii)Write a method called showData()
that will display the data of both the
objects from the main method.
iii) Write a statement to call the
parameterized constructor from the
default constructor using ‘this’
keyword. Also call the method from
the parameterized constructors.
8. W.A.P. to print a string in reverse. 16
9. W.A.P. to accept name and total 17-18
marks of N number of students in
two single subscript array may
name[] and totalmarks[].
Calculate and print:
i)The
i)The average of total marks
obtained by N number of students
[average=Sum of total marks of all
the students)/N]
ii)Deviation
ii)Deviation of each student’s total
marks with the average
[deviation=total marks of students-
average]
10. Design a class name ShowRoom with 19-21
the following description:
String name- to store the name of
the customer.
Long mobno- to store the mobile
numbers of the customer.
Double dis- to store the discount
amount.
Double cost- to store the cost of
items purchased.
Write a main method to create an
object of the class and call the above
member methods.
4
1) import java.util.Scanner;
class CountLetterA
{
public static void main(String args[])
{
Scanner kb=new Scanner(System.in);
System.out.println("Enter a sentence");
String Str=kb.nextLine();
str=str.toUppercase();
int count=0;
for(int i=0;i<str.length();i++)
{
if(i==0&&str;charAt(1)=='A')count++;
if(i>0)
if((str.CharAt(i-1)==' ')&&(str.CharAt(1)=='A'))count++;
}
System.out.println("Total number of words starting with letter 'A'"=+count);
}
}
5
St Joseph’s Convent School
2) import java.io.*;
import java.util.*;
class TechNumber
int i,a,b,sum;
String n;
for(i=1000;i<1000;i++)
n=i+"";
a=Integer.parseInt(n.substring(0,2));
b=Integer.parseInt(n.substring(2));
sum=(int)Math.pow((a+b),2);
if(sum==i)
System.out.println(i);
6
St Joseph’s Convent School
int n=sc.nextInt();
int b=(int)Math.sqrt(n);
int x=b*(b+1);
if(x==n)
else
7
St Joseph’s Convent School
4) import java.io.*;
import java.util.*;
class AscendingOrder
int i,j,temp;
System.out.println("Enter 15 integers:");
for (i=0;i<=15;i++)
arr[i]=sc.nextInt();
for (i=0;i<14;i++)
for(j=0;j<14-i;j++)
if(arr[j]>arr[i])
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
8
St Joseph’s Convent School
for(i=0;i<15;i++)
System.out.println(arr[i]);
}}
int i,j;
int x=sc.nextInt();
switch(x)
for(i=p.length();i>0;i--)
System.out.println();
for(j=0;j<i;j++)
System.out.println(p.charAt(j));
break;
case 2:p="BLUEJ";
for(i=0;i<p.length();i++)
System.out.println();
10
for(j=0;j<=i;j++);
System.out.println(p.charAt(i));
break;
default:System.out.println("Incorrect Option");
}}}
11
6) import java.io.*;
import java.util.*;
int i;
double a;
double sum=0;
for(i=1;i<=n;i++)
a=Math.pow(x,1);
sum=sum+a;
System.out.println(“Sum::”);
void series(int p)
int i;
for(i=1;i<=p;i++)
System.out.println((i*i*i)i-1+” ”);
12
void series()
double i;
double s=0;
for(i=2;i<=10;i++)
s=s+1/i;
System.out.println(“Sum:”+s);
13
7) public class Rectangle
Rectangle()
this(10.5f,5.5f);
length=0.0f;
breadth=0.0f;
Rectangle(float l,float b)
length=l;
breadth=b;
this.showdata();
void showdata()
float area;
area=length*breadth;
System.out.println("Length:-"+length);
System.out.println("Breadth:-"+breadth);
14
{
15
St Joseph’s Convent School
8) import java.io.*;
System.out.print("Enter a String-");
String str=br.readLine();
String reverse="";
int length=str.length();
char ch;
for(int i=length-1;i>=0;i--)
ch=str.charAt(i);
reverse=reverse+ch;
16
St Joseph’s Convent School
9) import java.io.*;
import java.util.Scanner;
class NameMarks
int N=sc.nextInt();
double sum=0;
for(int i=0;i<N;i++)
name[i]=sc.next();
System.out.print("Enter marks:");
totalmarks[i]=sc.nextIntO;
sum=sum+totalmarks[i];
double average=sum/N;
for(int i=0;i<N;i++)
17
St Joseph’s Convent School
deviation[i]=totalmarks[i]-average;
18
St Joseph’s Convent School
import java.lang.*;
double cost,dis,amount;
String name;
long mobileno;
public Showroom()
name="";
cost=0;
mobileno=0;
System.out.println("Enter Name:");
name=sc.next();
mobileno=sc.nextLong();
System.out.println("Enter cost");
19
cost=sc.nextDouble();
if(cost<=10000)
dis=cost*5/100;
amount=cost-dis;
if(cost>10000&&cost<=20000)
dis=cost*10/100;
amount=cost-dis;
if(cost>20000&&cost<=35000)
dis=cost*15/100;
amount=cost-dis;
if(cost>35000)
dis=cost*20/100;
amount=cost-dis;
}
20
St Joseph’s Convent School
System.out.println("Name:"+name);
System.out.println("Mobile no.:"+mobileno);
System.out.println("Cost:"+cost);
System.out.println("Discount:"+dis);
System.out.println("Amount:"+amount);
obj.input();
obj.Calculate();
obj.display();
21
www.shaala.com
ICSE class X Cordova Computer Applications
www.topperlearning.com
Signature 1 Signature 2
_____________ __________
22