0% found this document useful (0 votes)
54 views

Priya's Java Project Work

The document is a project submission by Priya Jaswal of class 10th B to her computer teacher Mrs. Payal. It contains 10 Java programs with descriptions and code snippets. The programs cover topics like string manipulation, arrays, classes, methods, and more. Priya thanks Mrs. Payal for giving her the opportunity to do this Java project and learn new things.

Uploaded by

Priya Jaswal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Priya's Java Project Work

The document is a project submission by Priya Jaswal of class 10th B to her computer teacher Mrs. Payal. It contains 10 Java programs with descriptions and code snippets. The programs cover topics like string manipulation, arrays, classes, methods, and more. Priya thanks Mrs. Payal for giving her the opportunity to do this Java project and learn new things.

Uploaded by

Priya Jaswal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

ST.

JOSEPH’S CONVENT SCHOOL

JAVA PROJECT WORK


2020 – 2021

Submitted By: Submitted To:

Priya Jaswal Mrs Payal

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

public static void main(String args[])

int i,a,b,sum;

String n;

System.out.println("Four digit tech numbers are:");

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

3) import java .util.*;

public class pronic_number

public static void main(String args[])

Scanner sc=new Scanner(System.in);

int n=sc.nextInt();

int b=(int)Math.sqrt(n);

int x=b*(b+1);

if(x==n)

System.out.println(n+"is a pronic number");

else

System.out.println(n+"is not a pronic number");

7
St Joseph’s Convent School

4) import java.io.*;

import java.util.*;

class AscendingOrder

public static void main(String args[])throws IOException

int i,j,temp;

Scanner sc=new Scanner(System.in);

int arr[]=new int[15];

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

System.out.println("Elements in ascending order are::");

for(i=0;i<15;i++)

System.out.println(arr[i]);

}}

St Joseph’s Convent School


9
5) import java.util.*;

public class Pattern

public static void main(String args[])

int i,j;

Scanner sc=new Scanner(System.in);

System.out.println("Enter your choice");

System.out.println("1 for pattern 1(or) 2 for pattern 2");

int x=sc.nextInt();

switch(x)

case 1:String p="ABCDE";

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();

St Joseph’s Convent School

10
for(j=0;j<=i;j++);

System.out.println(p.charAt(i));

break;

default:System.out.println("Incorrect Option");

}}}

St Joseph’s Convent School

11
6) import java.io.*;

import java.util.*;

public class OverloadSeries

void series(iny x,int n)

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+” ”);

St Joseph’s Convent School

12
void series()

double i;

double s=0;

for(i=2;i<=10;i++)

s=s+1/i;

System.out.println(“Sum:”+s);

St Joseph’s Convent School

13
7) public class Rectangle

float length, breadth;

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);

System.out.println("Area of Rectangle is:-"+area);

public static void main(String args[])

St Joseph’s Convent School

14
{

Rectangle r1=new Rectangle();

15
St Joseph’s Convent School

8) import java.io.*;

public class Reverse

public static void main(String args[])throws IOException

InputStreamReader isr=new InputStreamReader(System.in);

BufferedReader br=new BufferedReader(isr);

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;

System.out.println("Reverse of entered string is:"+reverse);

16
St Joseph’s Convent School
9) import java.io.*;

import java.util.Scanner;

class NameMarks

public static void main(String argsO)throws IOException

Scanner sc=new Scanner(System.in);

System.out.print("Enter number of students:");

int N=sc.nextInt();

String named=new String[N];

int totalmarksG=new int[N];

double deviation[]=new double[N];

double sum=0;

for(int i=0;i<N;i++)

System.out.print("Enter name of the student:");

name[i]=sc.next();

System.out.print("Enter marks:");

totalmarks[i]=sc.nextIntO;

sum=sum+totalmarks[i];

double average=sum/N;

System.out.println("The average of the total marks of"+N+"number of students"+average);

for(int i=0;i<N;i++)

17
St Joseph’s Convent School

deviation[i]=totalmarks[i]-average;

System.out.println("Deviation of"+name[i]+" s marks with average"+deviation[i]);

18
St Joseph’s Convent School

10) import java.util.Scanner;

import java.lang.*;

public class Showroom

double cost,dis,amount;

String name;

long mobileno;

public Showroom()

name="";

cost=0;

mobileno=0;

public void input()

Scanner sc=new Scanner(System.in);

System.out.println("Enter Name:");

name=sc.next();

System.out.println("Enter mobile no:");

mobileno=sc.nextLong();

System.out.println("Enter cost");

19
cost=sc.nextDouble();

public void Calculate()

St Joseph’s Convent School


{

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

public void display()

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);

public static void main(String args[])

Showroom obj=new Showroom();

obj.input();

obj.Calculate();

obj.display();

21
 www.shaala.com
 ICSE class X Cordova Computer Applications
 www.topperlearning.com

Signature 1 Signature 2
_____________ __________

22

You might also like