java assignment -1

6
Java Assignments C

Upload: jimi-kumar

Post on 25-Dec-2015

216 views

Category:

Documents


0 download

DESCRIPTION

Java Assignment-1

TRANSCRIPT

Page 1: Java Assignment -1

Java Assignments

C

Page 2: Java Assignment -1

Table of ContentsI. Assignment -1.......................................................................2

II. Assignment -2.......................................................................3

Page 3: Java Assignment -1

Assignment -1

1. Write a program to convert given temperature in Fahrenheit to Celsius using the following conversation formula. C = F – 32/ 1.8 .Take 5 different values and print data in tabular format.

2. The formula for calculating Depreciation is as follows Depreciation = purchase Price – Salvage value / Year of Service

Write a program to determine the salvage value of the item when the purchase price, year of service and the annual depreciation are given.

3. Write a Java Program which takes two input as value1 , value2 .

Write a logic in main method like belowIf value1 = value 2 then calculateSqureArea() method should call and it should print area of square.If either of value is 0 then calculateCircleArea() method should call and it should print area of circle.If both value are different then calculateRectangleArea() method should call and it should print area of rectangle.

4. Write a java program which takes input as number from the user and print whether the entered number is even or odd.

5. Write a java program which takes three number as input from user and find the biggest number out of this three number.

6. Write a java program which calculate sum of the digit of given number. Eg. If user enter 1234 then result should be 10.

UIAR COM 102 2

Page 4: Java Assignment -1

Assignment -2

1. Write a program in which define one array of 10 numbers. Using for loop iterate the each element of array and display sum of all the number stored in array.

2. Define a class Mathoperation. Declare two static method Add , ModuloDivision which takes two numbers as an input (arguments) and performed required operation. Call this method inside main.

3. Design Class Bank with following characteristics

Instance Variable: AccountHolder , AccountNumber, BalanceMethod : Deposit Amount, Withdrawl amount , Display name and Balance

4. Initialize instance variable using constructor in above program.

5. Write a program to sum all the integers between 1 and 1000, that are divisible by 13, 15 or 17, but not by 30.

6.

UIAR COM 102 3

Page 5: Java Assignment -1

UIAR COM 102 4