Skip to content

Java Lab Sheet Overview Welcome to the Java Lab Sheet! This document is designed to guide you through fundamental Java concepts, divided into four comprehensive modules.

License

Notifications You must be signed in to change notification settings

Annishivakumara/Lab_sheets_PU_M1.java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lab_sheets_PU_M1

MODULE 1

Java Lab Sheet Overview Welcome to the Java Lab Sheet! This document is designed to guide you through fundamental Java concepts, divided into four comprehensive modules. Whether you're a beginner or looking to strengthen your Java skills, these modules will provide you with practical exercises and valuable insights.

Module 1 - Introduction to Java
Write the following programs using Scanner class and Control Statements:
Q1. Write a program to accept the length of two line segments and check whether they are equal or unequal. Display the message accordingly. Requirements: a) Read the length of two line segments from user.
b) Display “Equal” if they are equal otherwise “Not Equal”.

Q2. Write a program to accept three numbers and check whether they are 'Pythagorean Triplets' or not.
If they are Pythagorean Triplets display “'Pythagorean Triplets'” otherwise display “Not a Pythagorean
Triplets” (Hint: Use Pythagoras Formula for a Right-angled Triangle: H2 = P2+B2)

Q3. Klaus wants to know his overall grade, which is calculated based on the average marks he achieved in all six subjects. Write a program to help him to determine the grade based on the following criteria. A: 90-100%
B: 80-89%
C: 70-79%
D: 60-69% F: Below 60% Requirements:
c) The individual marks scored by Klaus in all the six subjects has to be captured
d) The total and average mark has to be displayed.
e) Grade has to be displayed based on the average he scored.

Q4. Write a program to read an option from user to choose finding area and perimeter of Square, Rectangle and Circle.
The application has to provide a menu to the user to choose the options.
The application should provide the options continuously to the user till user choose 4th option exit.
Hint: You can exit the iterative flow using System.exit(0)
Requirements:
a) Display the Menu of Geometric shapes
1.Square
2.Rectangle
3.Circle
4.Exit
b) Capture the user choice
c) Capture the user inputs for calculating area and perimeter
d) Perform the operation based on the user choice
e) Display the result to the console.

Q5. Rebecca wants to assist her niece Hope in learning the alphabets. Write a Java program to help Rebecca generate all the uppercase letters using iterative constructs.

Q6. Write a java program to generate the pattern which is given below.

                                     *
                                    ***
                                   *****
                                  *******
                                   *****
                                    ***
                                     *

Q7. Mike is asking Eleven for help to figure out if he was born in a leap year. Write a program to assist Eleven in determining whether Mike’s birth year is a leap year or not. Requirements:
a) Read the year in which mike was born
b) If it is a leap year then display “Leap year” otherwise display “Not a leap year”.

About

Java Lab Sheet Overview Welcome to the Java Lab Sheet! This document is designed to guide you through fundamental Java concepts, divided into four comprehensive modules.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages