[go: up one dir, main page]

0% found this document useful (0 votes)
17 views1 page

Java Worksheet 1

The document is a worksheet for Class XII Information Technology focusing on Java programming. It includes exercises such as completing a switch-case statement, correcting Java code errors, creating a menu-driven program for arithmetic operations, and writing methods to calculate the sum of two numbers and the volume of a cylinder. The tasks aim to enhance students' understanding and application of Java programming concepts.

Uploaded by

Saradha S
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)
17 views1 page

Java Worksheet 1

The document is a worksheet for Class XII Information Technology focusing on Java programming. It includes exercises such as completing a switch-case statement, correcting Java code errors, creating a menu-driven program for arithmetic operations, and writing methods to calculate the sum of two numbers and the volume of a cylinder. The tasks aim to enhance students' understanding and application of Java programming concepts.

Uploaded by

Saradha S
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/ 1

CLASS: XII INFORMATION TECHNOLOGY (802)

DATE:8.07.2024 WORKSHEET 1 (JAVA PROGRAMMING )


1. Fill in the blanks to complete a switch-case statement in Java:
int day = 3;
switch (________) {
case 1:
System.out.println("Monday");
break;
case 2:
System.out.println("Tuesday");
break;
case 3:
System.out.println("__________");
break;
case 4:
System.out.println("Thursday");
break;
case 5:
System.out.println("Friday");

_________
System.out.println("Weekend");
}

2. Find errors in Java code snippets and correct them:


public class ErrorExample {
public static void main(String[] args) {
x = 5;
int y = 10;
int s = x + y;
System.out.println("The sum is: " sum);
}
3. Write a Menu-driven program to perform basic arithmetic operations using
Switch .
Write a Java program that displays a menu with options for addition, subtraction,
multiplication, and division. Depending on the user's choice (1 for addition, 2 for
subtraction, etc.), perform the corresponding operation on two numbers entered by the
user.
4. Write a Program to Calculate the Sum of Two Numbers using user defined method.
(Method name:sumof2numbers)
5. Calculate the Volume of a Cylinder using user defined method.(volume of Cylinder
=3.14* radius * radius * height)

You might also like