0% found this document useful (0 votes)
25 views44 pages

Naitik_Singh_9C_Computer-Project (1)

This project report on Java programming for Grade 9 includes various programming exercises that cover topics such as the Tribonacci series, calculating percentages, temperature conversion, and financial calculations. Each section provides a problem statement, Java code implementation, and sample input/output. The report is structured with acknowledgments, a table of contents, and detailed explanations of the code used for each exercise.
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)
25 views44 pages

Naitik_Singh_9C_Computer-Project (1)

This project report on Java programming for Grade 9 includes various programming exercises that cover topics such as the Tribonacci series, calculating percentages, temperature conversion, and financial calculations. Each section provides a problem statement, Java code implementation, and sample input/output. The report is structured with acknowledgments, a table of contents, and detailed explanations of the code used for each exercise.
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/ 44

PROJECT REPORT

ON
“JAVA PROGRAMMING”

GRADE – 9
SESSION - (2024-2025)

Submitted To:- SubmittedBy


Sana Maqsood Naitik Singh
9th C
ACKNOWLEDGEMENT-

I want to take a moment to express my heartfelt


gratitude for the chance to study computers. This
journey has been nothing short of amazing, and I
truly appreciate all the support I’ve received along
the way.

I’m especially thankful for my instructors and


mentors. Their guidance has been a game-changer
for me. The passion they bring to the subject is
contagious, and their willingness to share their
knowledge has inspired me to dive deeper and
explore the exciting possibilities in the world of
computers. Their encouragement has made a real
difference in my learning experience.
Sno. Title Page no. Remark
1. Question 1 5
2. Question 2 8
3. Question 3 9
4. Question 4 11
5. Question 5 13
6. Question 6 15
7. Question 7 17
8. Question 8 18
9. Question 9 21
10. Question 10 25
11. Question 11 27
12. Question 12 28
13. Question 13 31
14. Question14 34
15. Question 15 35
16. Question 16 38
17. Question 17 42
18. Question 18 45
19. Question 19 48
20. Question 20 51
21. Conclusion 54

Q1. Write a program to read the number n via the Scanner class and print the
Tribonacci series: 0, 0, 1, 1, 2, 4, 7, 13, 24, 44, 81 ...and so on.
Hint: The Tribonacci series is a generalization of the Fibonacci sequence
where each term is the sum of the three preceding terms.
Answer:-

/*
* @author=xyz

* @purpose=print the Tribonacci series

*/

import java.util.Scanner;

class tribonacci

public static void main()

int n,a,b,c,d;

Scanner sc =new Scanner(System.in);

System.out.println("Enter range of n = ");

n=sc.nextInt();

a=0;

b=0;

c=1;

d=a+b+c;

System.out.println(a);

System.out.println(b);

System.out.println(c);

System.out.println(d);
for(int i=1;i<n;i++)

a=b;

b=c;

c=d;

d=a+b+c;

System.out.println(d);//the addition of the last three numbers

Sno. Name Data type Scope Purpose


1. a int local 1 value
st

2. b int local 2nd value


3. c int local 3rd value
4. d int local Addition of 1st,2nd, and 3rd value
5. n int local Range of numbers

Sample input : 3

Sample output : 0

2
4

Q2. In a competitive examination, there were 150 questions. One candidate


got 80% correct and the other candidate 72% correct. Write a program to
calculate and display the correct answers each candidate got.

Answer -

/*

* @author=xyz

* @purpose=to find the amount of correct answers

*/

class CorrectAns

public static void main()

int ma,mb;

ma=150*80/100;//number of correct ans by A

mb=150*72/100;//number of correct ans by B

System.out.println("A got 80% correct and "+ma+" correct answers");

System.out.println("B got 72% correct and "+mb+" correct answers");

}
Sno. Name Data type Scope Purpose
1. ma int local Number of correct answers by A
2. mb int local Number of correct answers by B

Output : A got 80% correct and 120 correct answers

B got 72% correct and 108 correct answers

Q3. The normal temperature of the human body is 98.6°F. Write a program to
convert the temperature into degree Celsius and display the output.

Hint: c / 5 = f - 32 / 9

Answer -

/*

* @author=xyz

* @purpose=fahrenheit to Celsius

*/

class Temperature

public static void main()

float c,f;

f=(float)98.6;

c=(float)(5*((f-32)/9));// to calculate Celsius temperature

System.out.println("Celsius temperature = " c);


}

Sno. Name Data type Scope Purpose


1. f float local The Fahrenheit temperature of body
2. c float local Conversion of Fahrenheit to Celsius

Output - Celsius temperature = 37.0

Q4. The angles of a quadrilateral are in the ratio 3:4:5:6. Write a program to
find and display all its angles. [Hint: The sum of angles of a quadrilateral =
360°]

Answer -

/*

* @author=xyz

* @purpose=finding the angles of a polygon

*/

import java.util.Scanner;

class angles

public static void main()

{
int a,b,c,d;

float x;

a=3;

b=4;

c=5;

d=6;

x=(float)(360/(a+b+c+d));

System.out.println("angle 1 = "+(a*x));

System.out.println("angle 2 = "+(b*x));

System.out.println("angle 3 = "+(c*x));

System.out.println("angle 4 = "+(d*x));

Sno. Name Data Type Scope Purpose


1. a int Local 1st angle
2. b int Local 2nd angle
3. c int Local 3rd angle
4. d int Local 4th angle
5. x float Local The average of the angle

Output - angle 1 = 60.0

angle 2 = 80.0

angle 3 = 100.0

angle 4 = 120.0
Q5. The time period of a Simple Pendulum is given by the formula: T = 2π√(l/g)

Write a program to calculate the time period of a Simple Pendulum by taking


length and acceleration due to gravity (g) as inputs.

Answer -

/*

* @author=xyz

* @purpose=to find time period

*/

import java.util.Scanner;

class TimePeriod

public static void main()

double l,g;

double t;

g=9.8;

Scanner sc=new Scanner(System.in);

System.out.println("enter length");

l=sc.nextFloat();//taking length as input

t=(2*(Math.PI))*Math.sqrt(l/g);
System.out.println("time period = "+t);

Sno. Name Data type Scope Purpose


1. l double local length
2. g double local Gravitational constant
3. t double local Calculate time period

Input-10
Output- time period = 6.346975625940523

Q6. Write a program by using class 'Employee' to accept Basic Pay of an


employee. Calculate the allowances/deductions as given below.

Allowance/Deduction Rate
Dearness Allowance (DA) 30% of Basic Pay
House Rent Allowance (HRA) 15% of Basic Pay
Provident Fund (PF) 12.5% of Basic Pay

Finally, find and print the Gross and Net pay.


Gross Pay = Basic Pay + Dearness Allowance + House Rent Allowance
Net Pay = Gross Pay - Provident Fund

Answer -

/*

* @author=xyz

* @purpose=to find gross pay and net pay

*/

import java.util.Scanner;

class employee
{

public static void main()

int bp;

float da,hra,pf,np,gp;

Scanner sc=new Scanner(System.in);

System.out.println("enter your basic pay = ");

bp=sc.nextInt();

da=(float)bp*30/100;

hra=(float)bp*15/100;

pf=(float)(bp*12.5/100);

gp=bp+da+hra;

np=gp-pf;

System.out.println(“Gross pay+”+gp);

System.out.println(“Net pay = “np);

Sno. Name Data Type Scope Purpose


1. bp int local Taking base pay
2. da float local Calculating Dearness Allowance
3. hra float local Calculating House Rent Allowance
4. pf float local calculating Provident Fund
5. np float local Calculating Net pay
6. gp float local Calculating Gross pay

Input-10000
Output- Gross pay = 14500.0
Net pay = 13250.0

Q7. A shopkeeper offers a 10% discount on the printed price of a Digital


Camera. However, a customer must pay 6% GST on the remaining amount.
Write a program in Java to calculate the amount to be paid by the customer
taking printed price as an input.

Answer -

/*

* @author=xyz

* @purpose=to find final amount of digital camera

*/

import java.util.Scanner;

class gst

public static void main()

int p;

double d,gst,amt;

Scanner sc=new Scanner (System.in);

System.out.println("enter printed price");


p=sc.nextInt();

d=p-(p*10/100);

gst=d*6/100;

amt=(d+gst);

System.out.println("The amount to pay is "+amt);

Sno. Name Data Type Scope Purpose


1. p int local Printed price
2. d double local discount
3. gst double local Gst on discounted price
4. amt double local Final amount

Input-10000
Output- The amount to pay is 9540.0

Q8. Write a program to calculate the value of Pi with the help of the following
series: Pi = (4/1) - (4/3) + (4/5) - (4/7) + (4/9) - (4/11) + (4/13) - (4/15) ...
Hint: Use while loop with 100000 iterations.

/*

* @author=xyz

* @purpose=to find final amount of digital camera

*/
import java.util.*;

class pi

public static void main()

int i=100000;//no. of iterations

double pi=0,d=1;//value of denominator

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

if (j%2==0)

pi=pi+(4/d);

else

pi=pi-(4/d);

d=d+2;

System.out.println(pi);
}

Sno. Name Data Type Scope Purpose


1. i int local No. of iterations
2. pi double local Value of pi
3. d double local denominator
4. j int local For loop

Output - 3.1415826535897198

Q9. Mr. Lokesh invests certain sum at 5% per annum compound interest for
three years. Write a program in Java to calculate:
(a) the interest for the first year
(b) the interest for the second year
(c) the amount after three years.
Take sum as an input from the user.
Sample Input: Principal = ₹5000, Rate =10%, Time = 3 yrs
Sample Output: Interest for the first year: ₹500
Interest for the second year: ₹550
Interest for the third year: ₹605

Answer -

/*

* @author=xyz

* @purpose=to find intrest and amount

*/

import java.util.Scanner;

class intrest

{
public static void main()

int t;

double p,r,amt,i1,i2,i3;

Scanner obj=new Scanner(System.in);

System.out.println("Enter principle amount = ");

p=obj.nextDouble();

System.out.println("Enter rate of interest = ");

r=obj.nextDouble();

System.out.println("Enter time period in years = ");

t=obj.nextInt();

amt=p;

i1=(p*r)/100;

amt=amt+i1;

i2=(amt*r)/100;

amt=amt+i2;

i3=(amt*r)/100;

amt=amt+i3;

System.out.println("Interest for the first year:₹"+i1);

System.out.println("Interest for the second year:₹"+i2);


System.out.println("Interest for the third year:₹"+i3);

System.out.println("amount after the third year:₹"+amt);

Sno. Name Data Type Scope Purpose


1. p int local Principle amount
2. t double local Time
3. r double local Rate of interest
4. amt double local Final amount
5. i1 double local Interest in 1st year
6. i2 double local Interest in 2nd year
7. i3 double local Interest in 3rd year

Input- Enter principle amount = 10000

Enter rate of interest = 5

Enter time period in years = 4

Output- Interest for the first year: ₹500.0

Interest for the second year: ₹525.0

Interest for the third year: ₹551.25

amount after the third year: ₹11576.25


Q10.A businessman wishes to accumulate 3000 shares of a company.
However, he already has some shares of that company valuing ₹10 (nominal
value) which yield 10% dividend per annum and receive ₹2000 as dividend at
the end of the year. Write a program in Java to calculate the number of shares
he has and how many more shares to be purchased to make his target.
Hint: No. of share = (Annual dividend * 100) / (Nominal value * div%)

Answer -

/*

* @author=xyz

* @purpose=find no. of shares to be purchased

*/

class shares

public static void main()

int ts=3000;//target no. of shares

int nv=10;//nominal value per share

int dp=10;//dividend percentage

int ad=2000;//annual dividend

int s=(ad*100)/(nv*dp);

int stb=ts-s;//shares to buy


System.out.println("no. of shares already owned = "+s);

System.out.println("no. of shares to be purchased = "+stb);

Sno. Name Data Type Scope Purpose


1. ts int local Target no. of Shares
2. nv int local Normal value
3. dp int local Dividend percentage
4. ad int local Annual dividend
5. s int local Shares
6. stb int local Shares to buy

Output- no. of shares already owned = 2000

no. of shares to be purchased = 1000

Q11.A certain amount is invested at the rate of 10% per annum for 3 years.
Find the difference between Compound Interest (CI) and Simple Interest (SI).
Write a program to take amount as an input.
Hint: SI = (P * R * T) /100
A = P * (1(R/100))T
CI = A - P

/*

* @author=xyz

* @purpose=differentiate between CI and SI

*/
import java.util.*;

class IntrestDifference

public static void main()

double p,SI,a,CI,diff,t,r;

Scanner sc=new Scanner(System.in);

System.out.println("Enter principle amount = ");

p=sc.nextDouble();//taking principle as input

t=3;//time

r=10;//rate of intrest

SI=(p*r*t)/100;//Finding simple intrest

a=p*Math.pow((1+(r/100)),t);//Finding amount

CI=a-p;//Finding compound intrest

diff=CI-SI;//to find the difference

System.out.println("Compound intrest = "+CI);

System.out.println("Simple intrest = "+SI);

System.out.println("Difference between Ci and SI = "+diff);

}
Sno. Name Data Type Scope Purpose
1. p double local Principle amount
2. SI double local Calculate Simple interest
3. a double local amount
4. CI double local Claculate Compound interest
5. diff double local Difference between CI and SI
6. t double local Time
7. r double local Rate of interest

Input- 1000

Output- Compound interest = 331.00000000000045

Simple interest = 300.0

Difference between Ci and SI = 31.000000000000455

Q12.A shopkeeper sells two calculators for the same price. He earns 20%
profit on one and suffers a loss of 20% on the other. Write a program to find
his total cost price of the calculators by taking selling price as input.
Hint: CP = (SP / (1 + (profit / 100))) (when profit)
CP = (SP / (1 - (loss / 100))) (when loss)

/*

* @ author-xyz

* @purpose- To find and display The Cost Price

*/

import java.util. Scanner;

class CostPrice {

public static void main() {

double sp,CPpro,CPloss,tCP;
Scanner sc = new Scanner(System.in);

System.out.print("Enter the selling price: ");

sp= sc.nextDouble();

double pp= 20.0; // Profit percent

double lp = 20.0;// Loss percent

CPpro=sp/(1+(pp/100));

CPloss=sp/(1-(lp/100));

tCP = CPpro + CPloss;

System.out.println(" Cost price of calculator with profit: "+CPpro);

System.out.println("Cost price of calculator with loss; " +CPloss);

System.out.println("Total cost price of both calculators: "+tCP);

Sno. Name Data type Scope Purpose


1. sp double local Selling price as input
2. CPpro double local Cost with gain
3. CPloss double local Cost with loss
4. tCP double local Total cost price
5. pp double local Profit percent
6. lp double local Loss percent

Input - Enter the selling price: 600


Output- Cost price of calculator with profit: 500.0
Cost price of calculator with loss; 750.0
Total cost price of both calculators: 1250.0
Q13.Write a program to input a number and evaluate the results based on the
number entered by the user:
(a) Natural logarithm of the number
(b) Absolute value of the number
(c) Square root of the number
(d) Cube of the number
(e) Random numbers between 0 (zero) and 1 (one).

/*

* @author-xyz

* @purpose- Using Math Functions to find Value

*/

import java.util. Scanner;

class NumberEvaluation

public static void main()

Scanner sc = new Scanner(System.in);

System.out. print("Enter a number: ");

double num=sc.nextDouble();

double nl=Math.log(num) ;// natural logarithm

double av=Math.abs(num); // Absolute value

double sr=Math.sqrt(num); // Square root

double cb=Math. pow(num, 3); // Cube


double rn=Math.random(); // Random number from 0 to 1

System.out. println("Natural logarithm of the number = "+nl);

System.out.println("Absolute value of the number = "+av);

System.out.println("Square root of the number = "+sr);

System.out.println("Cube of the number = "+cb);

System.out.println("Random number from 0 to 1 = "+rn);

Sno Name Data Type Scope Purpose


1. num double local Input number
2. nl double local Natural log of number
3. av double local Absolute value
4. sr double local Square root
5. cb double local Cube
6. rn double local Random no. Between 0 and 1

Input- Enter a number: 100


Output- Natural logarithm of the number = 4.605170185988092
Absolute value of the number = 100.0
Square root of the number = 10.0
Cube of the number = 1000000.0
Random number from 0 to 1 = 0.2131319120780606
Q14.You want to calculate the radius of a circle by using the formula: Area =
(22/7) * r 2 ; where r = radius of a circle Hence the radius can be calculated as:
r = √((7 * area) / 22) Write a program in Java to calculate and display the radius
of a circle by taking area as an input.

Answer-

/*

* @author-xyz

* @purpose- To find the radius of a circle

*/

import java.util.Scanner;

class Radius {

public static void main() {

Scanner sc = new Scanner( System.in);

System.out.print("Enter the area of the circle: ");

double a= sc.nextDouble(); //input area

double r = Math.sqrt((7 * a) / 22); //radius formula

System.out.println(" The radius of the circle is: " + r);

Sno. Name Data Type Scope Purpose


1. a double local Input area
2. r double local To find radius
Input- Enter the area of the circle: 100
Output- The radius of the circle is: 5.640760748177662

Q15.Write a program to input three numbers and check whether they are
equal or not. If they are unequal numbers then display the greatest among
them otherwise, display the message 'All the numbers are equal'.
Sample Input: 34, 87, 61
Sample Output: Greatest number: 87
Sample Input: 81, 81, 81
Sample Output: All the numbers are equal.

Answer -

/*

* @author=xyz

* @purpose=caompare 3 numbers

*/

import java.util.*;

class compare

public static void main()

int num1,num2,num3;

Scanner sc=new Scanner (System.in);

System.out.println("Enter the three numbers = ");


num1=sc.nextInt();

num2=sc.nextInt();

num3=sc.nextInt();

if ((num1==num2)&&(num2==num3))

System.out.println("All no. are equal");

else if((num1>num2)&&(num1>num3))

System.out.println("the greatest no. is = "+num1);

else if((num1<num2)&&(num1>num3))

System.out.println("the greatest no. is = "+num2);

else if((num1>num2)&&(num1<num3))

System.out.println("the greatest no. is = "+num3);

}
}

Sno. Name Data Type Scope Purpose


1. num1 int local Input 1st no.
2. num2 int local Input 2nd no.
3. num3 int local Input 3rd no.

Input: 34, 87, 61


Sample Output: Greatest number: 87

Q16.Using a switch statement, write a menu driven program to:


(a) Generate and display the first 10 terms of the Fibonacci series 0, 1, 1, 2, 3,
5 The first two Fibonacci numbers are 0 and 1, and each subsequent number
is the sum of the previous two. (b)
Find the sum of the digits of an integer that is input.
Sample Input: 15390
Sample Output: Sum of the digits = 18
For an incorrect choice, an appropriate error message should be displayed.

/*

* @author-xyz

* @purpose- Use switch case for fibonacci or sum of digits of a number

*/

import java.util.Scanner;

class MathProgram

public static void main()

Scanner sc=new Scanner(System.in);


System.out.println("1 for Fibonacci Series");

System.out.println("2 for Sum of Digits of a Number");

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

int ch=sc.nextInt();

switch (ch)

case 1:

int a=0,b=1;

System.out.println("First 10 terms of the Fibonacci series:");

System.out.print(a+""+b+"");

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

System.out.print(a+""+b+"");

b=a+b;

a=b-a;

System.out.println();

break;

case 2:

System.out.print("enter an integer: ");


int num=sc.nextInt();

int sum=0;

while(num!=0)

sum=sum+(num%10);

num/=10;

System.out.println("Sum = "+sum);

break;

default:

System.out.println("Invalid");

Sno. Name Data Type Scope Purpose


1. ch int local For choosing option 1 or 2
2. i int local For loop
3. a int local For Fibonacci sequence
4. b int local For Fibonacci sequence
5. num int local As an input
6. sum int local For calculating sum of digits
Q17. Print a diamond star pattern using “*”.

Answer-

/*

* @author-xyz

* @purpose- To print a diamond star pattern

*/

class diamondPattern

public static void main()

int n = 5;

for (int i=1; i<=n;i++)

for (int j = 1; j <= n-i ;j++)

System.out.print(" ");

}
for ( int j = 1 ;j<=(2*i-1);j++)

System.out.print("*");

System.out.println();

for (int i=n-1;i>=1;i--)

for (int j = 1; j<=n-i;j++ )

System.out.print(" ");

for (int j = 1; j <= (2*i-1) ;j++)

System.out.print("*");

System.out.println();

}
Sno. Name Data type Scope Purpose
1. i int local For loop
2. j int local For loop

Q18.An Electricity Board charges for electricity per month from their
consumers according to the units consumed. The tariff is given below:

Units Consumed Charges


Up to 200 units ₹3.80/unit
More than 200 units and up to 300 units ₹4.40/unit
More then 300 units and up to 400 units ₹5.10/unit
More than 400 units ₹5.80/unit

Answer-

/*

* @author-xyz

* @purpose- calculate Electricity Bill

*/

import java.util.Scanner;
class Bill

public static void main()

Scanner sc=new Scanner(System.in);

System.out.print("Enter your name = ");

String name=sc.nextLine();

System.out.print("Enter units consumed = ");

int u=sc.nextInt();

double m=0;

//Calculate the bill amount based on the units consumed

if (m<=200)

m=u*3.80;

else if ((u<= 300)&&(u>200))

m= (200*3.80)+((u-200)*4.40);

else if ((u<=400)&&(u>300))

m=(200*3.80)+(100*4.40)+((m-300)*5.10);
}

else if(u>400)

m=(200*3.80)+(100*4.40)+(100*5.10)+((u-400)*5.80);

System.out.println("Customer Name = " + name);

System.out.println("Units Consumed = " + u);

System.out.println("Total Bill Amount = "+m);

Sno. Name Data type Scope Purpose


1. name string local Input name
2. u int local Units consumed
3. m int local Total bill amount

Q19.Write a program to generate a triangle or an inverted triangle based upon


user's choice of triangle to be displayed.
Example 1:
Input: Type 1 for a triangle
Enter your choice: 1
Sample Output:1 22
333
4444
55555
Example 2:
Input: Type 2 for an inverted triangle
Enter your choice: 2
Sample Output: 5 5 5 5 5
4444
333
22
1

Answer-

/*

* @author-xyz

* @purpose-To print pattern based on user's choice

*/

import java.util.Scanner;

class TriPattern

public static void main()

Scanner sc=new Scanner(System.in);

System.out.print("Enter your choice 1 or 2 :");

int c=sc.nextInt(); // Get the user's choice for triangle type

if (c==1) {

for (int i=1;i<=5;i++)


{

for (int j=1;j<=i;j++)

System.out.print(i+"");

System.out.println();

else if (c==2){

for (int i=5;i>=1;i--)

for (int j=1;j<=i;j++)

System.out.print(i+"");

System.out.println();

else

{
System.out.println("Invalid choice");

Sno. Name Data type Scope Purpose


1. c int local For type of triangle
2. i int local For loop
3. j int local For loop

Q20.Write a program to input a number and perform the following tasks:


(a) to check whether it is a prime number or not (b)
to reverse the number If
the number as well as the reverse is also 'Prime' then display 'Twisted Prime'
otherwise 'Not a twisted Prime'.
Sample Input: 167
Sample Output: 167 and 761 both are prime.
It is a 'Twisted Prime'.

Answer-

/*

*@author-xyz

*@purpose- To check if a number is a twisted prime

*/

import java.util.Scanner;
class TwistedPrime {

public static void main()

Scanner sc = new Scanner(System.in);// Input

System.out.print("Enter a number: ");

int num = sc.nextInt();

int i;

if (num <= 1) {

System.out.println(num + " is not a prime number.");

System.out.println("It is not a 'Twisted Prime'.");

return;

for (i = 2; i <= Math.sqrt(num); i++)

if (number % i == 0)

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

System.out.println("It is not a 'Twisted Prime'.");

return; // Exit the program

}
}

// Reverse number

int r= 0;

int Rnum= number;

while (Rnum != 0)

r = r* 10 + Rnum % 10;

Rnum =Rnum/10;

// Check if the reversed number is prime

if (reversed <= 1)

System.out.println(number + " is prime, but " + reversed + " is not


prime.");

System.out.println("It is not a Twisted Prime.");

return;

for (i = 2; i <= Math.sqrt(reversed); i++)

if (reversed % i == 0)

{
System.out.println(number + " is prime, but " + reversed + " is not
prime.");

System.out.println("It is not a Twisted Prime.");

return;

// If both the number and its reverse are prime

System.out.println(number + " and " + reversed + " both are prime.");

System.out.println("It is a Twisted Prime.");

Sno. Variable Data Type Scope Purpose


1 num int local To store no.
2 i int local For loop
3 r int local Reversed value
4 Rnum int local Reversed value

Conclusion –
My project experience with BlueJ provided insight into programming
and software development. The interface and educational nature of
BlueJ made it a perfect environment to learn and experiment in. Its
simplicity made it easy to navigate, and the visual representation of
classes and objects helped me grasp object-oriented programming
concepts very effectively. I was able to create and manipulate
objects directly, reinforcing my understanding of class interactions.

Throughout the project, I was faced with many challenges that


required me to prove my problem-solving skills. Debugging was
simple because there are built-in tools that allow a person to step
through their code and inspect variables in real time, which has
been particularly helpful for identifying and correcting logical errors.

my experience in BlueJ was both educational and rewarding. I


developed a solid foundation in Java, honed my problem-solving
abilities, and ignited a passion for software development that I look
forward to exploring further.

You might also like