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

Oop Practical List

The document provides details of practical assignments related to Java programming. It includes tasks like writing programs to calculate commissions, display prime numbers, and compute future investment values. It also describes creating classes to perform operations on complex numbers and distances in inches and feet.

Uploaded by

dojeka9685
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)
21 views2 pages

Oop Practical List

The document provides details of practical assignments related to Java programming. It includes tasks like writing programs to calculate commissions, display prime numbers, and compute future investment values. It also describes creating classes to perform operations on complex numbers and distances in inches and feet.

Uploaded by

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

OLD List of Practical’s

Pract Remark
Name Of The Practical Unit
. No.

Introduction to Java as an Object Oriented Programming Language, with Simple java


1 I
sample program. Program

1.a) You have just started a sales job in a department store. Your pay consists
of a base salary and a commission. The base salary is $5,000. The scheme
Simple java
shown below is used to determine the commission rate.
Program
Sales Amount Commission Rate
$0.01–$5,000 8 percent
$5,000.01–$10,000 10 percent
$10,000.01 and above 12 percent
Your goal is to earn $30,000 in a year. Write a program that will find out the
minimum amount of sales you have to generate in order to make $30,000.
1.b) Your program prints five lines. Each line consists of three parts. The first
part comprises the spaces before the numbers; the second part, the leading
numbers, such as 3 2 1 on line 3; and the last part, the ending numbers, such
as 2 3 on line 3
II
1
212
32123
4321234
543212345
1.c) Displays the first 50 prime numbers in five lines, each of which contains
10 numbers. An integer greater than 1 is prime if its only positive divisor is 1
or itself. For example, 2, 3, 5, and 7 are prime numbers, but 4, 6, 8, and 9 are
not.
The problem can be broken into the following tasks:
• For number = 2, 3, 4, 5, 6, ..., test whether the number is prime.
• Determine whether a given number is prime.
• Count the prime numbers.
• Print each prime number, and print 10 numbers per line.
2 Methods II
2A) Write a Java method to compute the future
Classes and
investment value at a given interest rate for a
specified number of years. Object
Sample data (Monthly compounded) and Output:
Input the investment amount: 1000
Input the rate of interest: 10
Input number of years: 5

Expected Output:
Years FutureValue
1 1104.71
2 1220.39
3 1348.18
4 1489.35
5 1645.31
2B) Write a Java method to count the number of
digits in an integer with the value 2. The integer may
be assumed to be non-negative.

Expected Output:
Input a number: 12541
1

2C)Print Fibonacci series upto 10 numbers (use recursive method)

Object , Class and Constructer

3(a) Print the sum, difference and product of two complex numbers by creating a II Classes and
class named 'MyComplex' with separate methods for each operation whose Object and
real and imaginary parts are entered by user. Constructer

Create a class InchFeet with method to display totalDistance after adding Classes and
3(b) two distances also write a method to find the difference between two II Object and
distances. Constructer

You might also like