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

Java and MySQL Project Acknowledgement

The document is a project report by Riyam Kumar from Army Public School, Ranikhet, acknowledging the support of his teacher, parents, and friends. It includes a certificate of completion for a project on Java programming and MySQL syntax, along with various Java programs and MySQL commands. The report concludes with a bibliography listing relevant resources and websites.

Uploaded by

anvi00191
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)
8 views21 pages

Java and MySQL Project Acknowledgement

The document is a project report by Riyam Kumar from Army Public School, Ranikhet, acknowledging the support of his teacher, parents, and friends. It includes a certificate of completion for a project on Java programming and MySQL syntax, along with various Java programs and MySQL commands. The report concludes with a bibliography listing relevant resources and websites.

Uploaded by

anvi00191
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

Acknowledgement

I would like to express my heartfelt gratitude


to Mr. Hem Pant, my respected I.T. teacher,
for his constant support, guidance, and
encouragement throughout the completion of
this project titled “Java Program and MySQL
Syntax”

His valuable insights and patient


explanations helped me understand the
experimental concepts clearly and complete
this project successfully. I also thank Army
Public School, Ranikhet, for providing the
facilities and environment required for
conducting this practical work.

Lastly, I extend my sincere thanks to my


parents and friends for their encouragement
and moral support during the course of this
project.

Riyam Kumar
Class 12th A
ceRtIfIcAte
tHIS IS to ceRtIfy tHAt RIYAM KUMAR,
clASS: XII A of ARMY PUBLIC SCHOOL,
RANIKHET, SUcceSSfUlly completed HIS
pRoJect In INFORMATION TECHNOLOGY
SUBJect AS pReScRIBed By C.B.S.E. In yeAR
2025-26.

tHIS pRoJect IS ABSolUtely genUIne And


doeS not IndUlge In plAgIARISm of Any kInd.
tHe RefeRenceS tAken In mAkIng tHIS
pRoJect HAve Been declARed At tHe end of
tHIS pRoJect

dAte:

SIgnAtURe SIgnAtURe
(SUBJect teAcHeR) (eXAmIneR)
IndeX
❖ Acknowledgement
❖ Certificate
❖ Java Programs
❖ MySQL Syntax
❖ Bibliography
JAVA PROGRAMS
1.) public class HelloWorld {

public static void main(String[] args) {

[Link]("Hello World");

2.) import [Link];

public class Sum {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter two numbers: ");

int a = [Link]();

int b = [Link]();

[Link]("Sum = " + (a + b));

}
import [Link];

public class EvenOdd {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter a number: ");

int n = [Link]();

if (n % 2 == 0)

[Link]("Even");

else

[Link]("Odd");

3.) import [Link];

public class EvenOdd {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter a number: ");

int n = [Link]();

if (n % 2 == 0)
[Link]("Even");

else

[Link]("Odd");

4.) import [Link];

public class Largest {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter three numbers: ");

int a = [Link](), b = [Link](), c =


[Link]();

int max = (a > b) ? (a > c ? a : c) : (b > c ? b :


c);

[Link]("Largest number: " + max);

5.) import [Link];

public class LeapYear {


public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter year: ");

int y = [Link]();

if ((y % 4 == 0 && y % 100 != 0) || (y % 400 ==


0))

[Link]("Leap Year");

else

[Link]("Not a Leap Year");

6.) import [Link];

public class SumNatural {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter n: ");

int n = [Link]();

int sum = 0;

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

sum += i;
[Link]("Sum = " + sum);

7.) import [Link];

public class Table {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter number: ");

int n = [Link]();

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

[Link](n + " x " + i + " = " + (n *


i));

8.) import [Link];

public class Factorial {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter number: ");


int n = [Link]();

int fact = 1;

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

fact *= i;

[Link]("Factorial = " + fact);

9.) import [Link];

public class Reverse {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter number: ");

int n = [Link](), rev = 0;

while (n > 0) {

rev = rev * 10 + n % 10;

n /= 10;

[Link]("Reversed number: " + rev);

}}
10.) import [Link];

public class Palindrome {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter number: ");

int n = [Link](), rev = 0, temp = n;

while (n > 0) {

rev = rev * 10 + n % 10;

n /= 10;

if (rev == temp)

[Link]("Palindrome");

else

[Link]("Not Palindrome");

11.) import [Link];

public class Fibonacci {

public static void main(String[] args) {


Scanner sc = new Scanner([Link]);

[Link]("Enter terms: ");

int n = [Link]();

int a = 0, b = 1;

[Link](a + " " + b);

for (int i = 2; i < n; i++) {

int c = a + b;

[Link](" " + c);

a = b;

b = c;

12.) import [Link];

public class SumDigits {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter number: ");

int n = [Link](), sum = 0;


while (n > 0) {

sum += n % 10;

n /= 10;

[Link]("Sum of digits = " + sum);

13.) import [Link];

public class Prime {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter number: ");

int n = [Link]();

int count = 0;

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

if (n % i == 0)

count++;

if (count == 2)
[Link]("Prime");

else

[Link]("Not Prime");

14.) import [Link];

public class Armstrong {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter number: ");

int n = [Link](), sum = 0, temp = n;

while (n > 0) {

int d = n % 10;

sum += d * d * d;

n /= 10;

if (sum == temp)

[Link]("Armstrong Number");

else
[Link]("Not Armstrong");

15.) import [Link];

public class Average {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter count: ");

int n = [Link]();

double sum = 0;

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

[Link]("Enter number " + i + ": ");

sum += [Link]();

[Link]("Average = " + (sum / n));

}
16.) import [Link];

public class ArrayInput {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

int[] arr = new int[5];

[Link]("Enter 5 elements:");

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

arr[i] = [Link]();

[Link]("Array elements are:");

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

[Link](arr[i] + " ");

17.) import [Link];

public class Smallest {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

int[] arr = new int[5];

[Link]("Enter 5 elements:");
for (int i = 0; i < 5; i++)

arr[i] = [Link]();

int min = arr[0];

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

if (arr[i] < min)

min = arr[i];

[Link]("Smallest = " + min);

18.) import [Link];

public class Vowels {

public static void main(String[] args) {

Scanner sc = new Scanner([Link]);

[Link]("Enter a string: ");

String s = [Link]().toLowerCase();

int count = 0;

for (int i = 0; i < [Link](); i++) {

char c = [Link](i);

if ("aeiou".indexOf(c) != -1)
count++;

[Link]("Number of vowels: " +


count);

19.) class Student {

String name;

int age;

void input(String n, int a) {

name = n;

age = a;

void display() {

[Link]("Name: " + name);

[Link]("Age: " + age);

public class StudentMain {


public static void main(String[] args) {

Student s1 = new Student();

[Link]("Riyam", 17);

[Link]();

20.) class Rectangle {

int length, breadth;

void input(int l, int b) {

length = l;

breadth = b;

int area() {

return length * breadth;

}
public class RectangleMain {

public static void main(String[] args) {

Rectangle r1 = new Rectangle();

[Link](5, 10);

[Link]("Area = " + [Link]());

}
MySQL Syntax
1.) CREATE DATABASE school;

USE school;

CREATE TABLE student (

admno INT PRIMARY KEY,

name VARCHAR(30),

class INT,

marks INT);

2.) INSERT INTO student VALUES (102, 'Amit',


11, 90);
3.) SELECT * FROM student;
4.) SELECT name, marks FROM student WHERE
marks > 85;
5.) UPDATE student SET marks = 95 WHERE
admno = 101;
BIBlIogRApHy
❖ I.T. N.C.E.R.T. Textbook

weBSIteS
❖ [Link]
❖ [Link]
❖ [Link]

Common questions

Powered by AI

The MySQL command `SELECT name, marks FROM student WHERE marks > 85` filters the records by selecting only those students whose marks are greater than 85. Such filtering is useful in databases for retrieving specific subsets of data that meet certain criteria, allowing for focused analysis and decision-making.

The Palindrome program uses a while loop to reverse the digits of the input number. It repeatedly extracts the last digit by computing the remainder of division by 10, appends it to the reversed number, and reduces the original number by one digit through integer division by 10. Finally, it checks if the reversed number matches the original number to determine if it's a palindrome.

The LeapYear Java program determines if a year is a leap year using conditional statements. It checks if the year is divisible by 4 and not divisible by 100, or if it is divisible by 400. If either condition is true, it prints "Leap Year", otherwise "Not a Leap Year".

The Scanner class in Java is used to receive user input. Most of the programs in the document, such as Sum, EvenOdd, and Reverse, use Scanner to read integers from the user. For example, in the Sum program, it reads two integers that are added together and the result is displayed to the user.

The SumNatural program uses a for loop to iterate from 1 to n, incrementally adding each integer to the sum variable. By updating the sum in each loop iteration, the program efficiently calculates the cumulative sum. This approach is effective because it breaks down the problem into simple repetitive steps, making the solution scalable and straightforward to implement.

Setting a primary key in a MySQL table, as seen with `admno INT PRIMARY KEY`, ensures each record in the table is uniquely identifiable. This prevents duplicate records and establishes a point of reference for relationships with other tables, crucial for maintaining data integrity and enabling efficient data retrieval in relational databases.

Using Scanner for sequential input is simple and effective for basic console applications, as seen in the projects where users input numbers or strings in sequence. However, it may not handle unexpected input types smoothly and lacks advanced features for formatted or structured data processing, which are drawbacks for more complex applications needing robust error handling or GUI integration.

The Factorial program uses a for loop to multiply a sequence of numbers from 1 to n, progressively accumulating the product to calculate the factorial. The Fibonacci program utilizes a loop starting from the third term, repeatedly calculating the next term by summing the previous two terms, updating variables at each iteration. The difference lies in the accumulation (factorial) versus iterative term calculation (Fibonacci).

The Armstrong program determines if a number is an Armstrong number by checking if the sum of the cubes of its digits equals the original number. The program extracts each digit and computes its cube, sums these cubes, and compares the result to the original number. This uses the principle of number properties where an Armstrong number is equal to the sum of its digits each raised to the power of three.

The modulus operator (%) is used to determine the remainder of a division operation. In the EvenOdd program, it checks if `n % 2` is equal to 0, indicating the number is even since even numbers are divisible by 2 without a remainder. If `n % 2` is not 0, the number is odd. This principle identifies even or odd numbers by their divisibility by 2.

You might also like