0% found this document useful (0 votes)
8 views13 pages

Report File

Uploaded by

epubbysudsou
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)
8 views13 pages

Report File

Uploaded by

epubbysudsou
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/ 13

SD Sir’s Classes

Project Report File

Name: Soumyajit Das


Class: IX
Roll Number: 30
Subject: Computer Applications
Topic: Java Programming
Session: 2024 – 2025
Certificate of
Completion
This is Soumyajit Das of Class IX has
been certified to be the bonafide work
of the student in the Computer
Laboratory during the academic
session 2024 – 2024.

x practical out of 20 has been certified.

Teacher Principal
Table of contents
1. Introduction to Java
2. Applications of Java
3. Some simple programs
4. Programs based on mathematics
5. Input based programs
6. Real life application type programs
7. Conclusion
8. Bibliography
9. Source Code

Introduction to Java
Java is a high-level, class-based, object-
oriented programming language that is
designed to have as few implementation
dependencies as possible. It is a general-
purpose programming language intended to
let programmers write once, run anywhere
(WORA), meaning that compiled Java code
can run on all platforms that support Java
without the need to recompile.

Applications of Java
Java is used everywhere. In phones, IoT
Applications, Operating Systems, etc.
Some of the examples are given below:
 Android Operating System
 Minecraft
 Samsung Key Pad Phones
 Websites Using Java
There are several games which are also
made using java.

Some simple programs


 Welcome Message
 Making Different Star Pattern
 Making Pyramids
 A Simple Quiz Software
 Certificate generator
Welcome_Message.java
public class Welcome_Message {
public static void main(String[] args) {
var YourName = "Soumyajit Das"; // Any Name You want
System.out.println("Hello "+YourName+"! Welcome To My Project");
}
}

Star_Pattern_1.java
public class Star_Pattern_1 {
public static void main(String args[]) {
//i for rows and j for columns
//row denotes the number of rows you want to print
int i, j, row = 6;
//outer loop for rows
for (i = 0; i < row; i++) {
//inner loop for columns
for (j = 0; j <= i; j++) {
//prints stars
System.out.print("* ");
}
//throws the cursor in a new line after printing each line
System.out.println();
}
}
}

Star_Pattern_2.java
public class Star_Pattern_2 {
public static void main(String args[]) {
//i for rows and j for columns
//row denotes the number of rows you want to print
int i, j, row = 6;
//Outer loop work for rows
for (i = 0; i < row; i++) {
//inner loop work for space
for (j = 2 * (row - i); j >= 0; j--) {
//prints space between two stars
System.out.print(" ");
}
//inner loop for columns
for (j = 0; j <= i; j++) {
//prints star
System.out.print("* ");
}
//throws the cursor in a new line after printing each line
System.out.println();
}
}
}

Pyramid.java
public class Pyramid {
public static void main(String args[]) {
//i for rows and j for columns
//row denotes the number of rows you want to print
int i, j, row = 6;
//Outer loop work for rows
for (i = 0; i < row; i++) {
//inner loop work for space
for (j = row - i; j > 1; j--) {
//prints space between two stars
System.out.print(" ");
}
//inner loop for columns
for (j = 0; j <= i; j++) {
//prints star
System.out.print("* ");
}
//throws the cursor in a new line after printing each line
System.out.println();
}
}
}

Quiz_App.java
import java.util.Scanner;

public class Quiz_App {


public static void main(String[] args) {
// Initialize the questions and answers
String[][] questions = {
{"1. What is the capital of France?", "a) London", "b) Paris", "c) Berlin", "d) Madrid"},
{"2. Who wrote 'Hamlet'?", "a) Charles Dickens", "b) William Shakespeare", "c) Mark
Twain", "d) Leo Tolstoy"},
{"3. What is the chemical symbol for water?", "a) O2", "b) CO2", "c) H2O", "d)
H2SO4"},
{"4. How many continents are there?", "a) 5", "b) 6", "c) 7", "d) 8"},
{"5. What planet is known as the Red Planet?", "a) Earth", "b) Mars", "c) Jupiter", "d)
Venus"}
};

// Answers to the questions


char[] answers = {'b', 'b', 'c', 'c', 'b'};

// Initialize score and scanner


int score = 0;
Scanner scanner = new Scanner(System.in);

// Iterate through each question


for (int i = 0; i < questions.length; i++) {
// Display the question and options
System.out.println(questions[i][0]);
for (int j = 1; j <= 4; j++) {
System.out.println(questions[i][j]);
}

// Get user's answer


System.out.print("Your answer: ");
char userAnswer = scanner.next().charAt(0);

// Check if the answer is correct


if (userAnswer == answers[i]) {
score++;
System.out.println("Correct!\n");
} else {
System.out.println("Wrong! The correct answer is " + answers[i] + ".\n");
}
}

// Display final score


System.out.println("Quiz completed! Your final score is " + score + " out of " +
questions.length + ".");

// Close the scanner


scanner.close();
}
}
Programs Based on
Mathematics
 Pi Teller
 Area of Cube & Cuboid
 Currency Converter
 Tax Calculator
 BPM Calculator
Pi_Teller.java
public class Pi_Teller {
public static void main(String[] args) {
int pi_val = 22/7;
System.out.println("The Value of PI is: "+pi_val);
}
}

Area_cube_cuboid.java
public class Area_cube_cuboid {
public static void main(String[] args) {
int h = 3;
int l = 2;
int b = 4;
int cube = l * b * h;
System.out.println(cube);
int cuboid = (2*(l + b)) + (2*(l + h)) + (2*(b + h));
System.out.println(cuboid);
}
}
Currency_Convert.java
public class Currency_Convert {
public static void main(String[] args) {
// Amount in Indian Rupees
double inr = 2;

// Conversion rate from INR to USD (assuming 1 INR = 0.012 USD for example)
double conversionRate = 0.012;

// Calculate the amount in USD


double usd = inr * conversionRate;

// Display the result


System.out.println(inr + " Indian Rupees is equal to " + usd + " US Dollars.");
}
}

You might also like