0% found this document useful (0 votes)
2 views2 pages

Extra Sheet Java After Work Sheet

The document outlines several Java programming exercises, including converting minutes to years and days, identifying vowels and consonants, generating the Fibonacci sequence, printing Floyd's Triangle, and computing the sum of digits in an integer. Each exercise includes test data and expected output for validation. These tasks are designed to enhance understanding of basic programming concepts and control structures in Java.

Uploaded by

saifalhomimat
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)
2 views2 pages

Extra Sheet Java After Work Sheet

The document outlines several Java programming exercises, including converting minutes to years and days, identifying vowels and consonants, generating the Fibonacci sequence, printing Floyd's Triangle, and computing the sum of digits in an integer. Each exercise includes test data and expected output for validation. These tasks are designed to enhance understanding of basic programming concepts and control structures in Java.

Uploaded by

saifalhomimat
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/ 2

Extra Sheet

Object Oriented Programming (1) Lab-Part 1


Basic
Write a Java program to convert minutes into a number of years and days.

Test Data
Input the number of minutes: 3456789
Expected Output :
3456789 minutes is approximately 6 years and 210 days

Selection Statements
Write a Java program that takes the user to provide a single character from the alphabet. Print Vowel or
Consonant, depending on the user input. If the user input is not a letter (between a and z or A and Z), or is a
string of length > 1, print an error message.

Test Data
Input an alphabet: p
Expected Output :
Input letter is Consonant

LOOP
Write a Java program to print the value of the Fibonacci sequence. The Fibonacci sequence for entered
number from the user is defined by the following rule. The first 2 values in the sequence are 1, 1. Every
subsequent value is the sum of the 2 values preceding it, the variable t from user represents the number of
items within Fibonacci sequence.
Nested Loop
Write a program in Java to print the Floyd's Triangle.

Test Data
Input number of rows : 5
Expected Output :

01

101

0101

10101

Methods
Write a Java method to compute the sum of the digits in an integer.

Test Data:
Input an integer: 25
Expected Output:
The sum is 7

You might also like