0% found this document useful (0 votes)
67 views18 pages

Computer Projrct.

Uploaded by

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

Computer Projrct.

Uploaded by

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

JAVA

BLUEJ
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to my teacher for their guidance and support
throughout this ICSE computer project. Their invaluable insights and encouragement greatly
contributed to the project's success. I also appreciate the resources and tools provided by our
school, which facilitated the learning and development process. Special thanks to my
classmates and peers for their collaborative spirit and feedback. Lastly, I am grateful to my
family for their patience and understanding during the project's completion. This project has
been a rewarding experience, and I deeply appreciate everyone who contributed to its
achievement.
INDEX
INTRODUCTION
James Gosling, known as the "father of Java," is a renowned computer scientist
who led the development of the Java programming language at Sun Microsystems
in the mid-1990s. His work on Java has had a profound impact on software
development, contributing to the language's widespread use in applications
ranging from web servers to mobile devices.

BlueJ is an integrated development environment (IDE) designed for teaching and


learning Java programming. Created by Michael Kölling and John Rosenberg, it
provides an interactive and visual approach to learning object-oriented
programming concepts. It is widely used in educational settings due to its
simplicity and user-friendly interface.
PROGRAMS
QUESTION – 1
Ifa= 5, b = 9, write a program to calculate the value of a + = a++ - ++b + a.

SOLUTION
PROGRAM
import java.util.*;
public class program1
{
public static void main(String args[])
{
int a, b;
a=5;
b=9;
a+=a++ - ++b + a;
System.out.println("The value of a+=a++ - ++b + a is "+a);
}
}
OUTPUT
QUESTION – 2
Rewrite the following program correctly:-

class Sample
public void main [] ;
{
X= 2
y= 2.2;
float z= x* y;
System.out.printline("Value of X++ =" (X++)
system.out.println("Value of z="+z)
}

SOLUTION

class Sample
{
public static void main(String args [ ])
{
int x= 2;
float y= (float) 2.2;
float z= x*y;
System.out.println("Value of x++ =" + (x++));
System.out.println("Value of z="+z);
}
}
QUESTION – 3
what is the output of the following:
i) char c = 'A';
short m = 25;
double n=c+ m;
System.out.printin(n);
ii) int x = 10, y = 5, z;
if(x > y | x ==y)
Z = ++x + --y;
System.out.println(z + " " + x + " " + y);

SOLUTION
i) Output – 90

ii) Output – 14 11 4

QUESTION – 4
What are the types of casting shown by the following examples?
(i) double X = 15.2;
int y = (int) x;
(ii) int x = 12;
long y = X;

SOLUTION
i) This is an explicit type casting

ii) This is an implicit type casting


QUESTION – 5
Write a java expression for ut+ ½ ft2
SOLUTION
The Java expression is (u*t )+ (½ *( f*t*t))

QUESTION – 6
The following program prints out the pattern given below :-
2
24
246
2468
SOLUTION
PROGRAM
import java.util.*;
public class program6
{
public static void main(String args[])
{
int i,j;
for (i=2;i<9;i=i+2)
{
for (j=2;j<=i;j=j+2)
{
System.out.print(j+" ");
}
System.out.println();
}
}
}
OUTPUT
QUESTION – 7
A hotel is giving seasonal discount on the total to be paid by the person staying
at the time of check out. The charges for amount one day stay is 850.0 per room.
The discount will be given asper the following criteria:
Number of days stayed Discount on total amount
Upto 5 days 10%
>5 days and <= 10 days 15%
> 10 days and<= 20 days 20%
More than 20 days 25%

Write a program to input name of guest, number of days stayed in the hotel.
Calculate the total amount to be paid and total discount amount. Find the net
balance to be paid excluding the discount. Print the bill including all the data.

SOLUTION
PROGRAM
import java.util.*;
public class program7
{
public static void main(String args[])
{
Scanner in = new Scanner (System.in);
int t;
double a,d,da,na;
String name;
System.out.println("Enter Guest's Name ");
name=in.nextLine();
System.out.println("Enter No. of Days Stayed in the Hotel");
t=in.nextInt();
a=t*850;
if(t<=5)
{
d=0.10;
}
else if(t>5 && t<=10)
{
d=0.15;
}
else if(t>10 && t<=20)
{
d=0.20;
}
else
{
d=0.25;
}
da=a*d;
na=a-da;
System.out.println("Total Amount = "+a);
System.out.println("Discount Amount = "+da);
System.out.println("Net Amount to be Paid = "+na);
}
}
OUTPUT
QUESTION – 8
Compute and display the sum of the following series :-

S=

SOLUTION
PROGRAM
import java.util.*;
public class program8
{
public static void main(String args[])
{
Scanner in = new Scanner (System.in);
int i,x,n;
double s=0;
System.out.println("Enter the value of x");
x=in.nextInt();
System.out.println("Enter no. of terms");
n=in.nextInt();
for(i=1;i<=n;i++)
{
if(i%2==0)
{
s-=(Math.pow(x,i))/i;
}
else
{
s+=(Math.pow(x,i))/i;
}
}
System.out.println("Sum = "+s);
}
}

OUTPUT
QUESTION -9
Input an integer and print the sum of first and last digits of that number.
Example:-
Input :
n = 8452
Output:-
Sum of first and last digit = 8+2=10
SOLUTION
PROGRAM
import java.util.*;
public class program9
{
public static void main (String args[])
{
Scanner in =new Scanner(System.in);
int n,cn,s,ld,fd; double d=0.1;
System.out.println("Enter an Integer");
n=in.nextInt();
cn=n;
ld=n%10;
while(n>0)
{
d*=10;
n=n/10;
}
fd=(int)(cn/d);
s=fd+ld;
System.out.println("Sum = "+s);
}
}
OUTPUT
CONCLUSION
In completing this Class 10 ICSE computer project using Java, I have gained
valuable hands-on experience with key programming concepts and problem-
solving skills. By designing and implementing the project, I have applied my
understanding of Java syntax, object-oriented principles, and practical coding
techniques. This project has not only enhanced my technical proficiency but
also demonstrated the real-world application of Java in creating functional
software solutions. Through iterative development and debugging, I have
learned the importance of attention to detail and perseverance. Overall, this
project has solidified my foundation in programming and prepared me for future
challenges in computer science.
BIBLIOGRAPHY
 ICSE Understanding Computer Applcation Class – 10 – A.P.C Publication
 Bluej

You might also like