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

Lab One

The document introduces basic elements of Java through 5 programming exercises: 1) Displaying numbers with System.out statements, 2) Calculating circle properties, 3) Calculating body mass index, 4) Converting currencies, and 5) Modifying the currency converter to continuously run without re-input.
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)
18 views1 page

Lab One

The document introduces basic elements of Java through 5 programming exercises: 1) Displaying numbers with System.out statements, 2) Calculating circle properties, 3) Calculating body mass index, 4) Converting currencies, and 5) Modifying the currency converter to continuously run without re-input.
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/ 1

Lab one: Introduction to basic elements of java

Objective

 To get students introduced with Net Beans development environment


 To enable the students to write and run simple java applications
 Demonstrate variable usage and basic input output operations using java language

Recommendations
o Write a comment about the purpose of each program
o Use small case identifier for your variable
o Capitalize first letter of your class identifier
1. Simple message display

Write an application that displays the numbers 1 to 4 on the same line, with each pair of adjacent
numbers separated by one space. Write the program using the following techniques:

a) Use one System.out.println statement.

b) Use four System.out.print statments.

2. Diameter, Circumference and Area of a Circle


Write an application that inputs from the user the radius of a circle as an integer and prints the
circle’s diameter, circumference and area using the floating value 3.14159 for . Use the
following formulas (r is the radius):
diameter=2r, circumference=2 area=
3. Body Mass Index Calculator (BMI)
Create a BMI calculator that reads the user’s weight in kilograms and height in meters, then
calculates and displays the user’s body mass index. The formula for calculating BMI is

Also, display the following information from the Department of Health and Human
Services/National Institutes of Health so the user can evaluate his/her BMI:

4. Currency Calculator
Write a program that reads ETB from user, then calculates and displays its U.S dollar, Euro, and
Rupee equivalent. Use the following rates:
1 U.S dollar = 27.8 ETB
1 Euro = 32.5 ETB
1 ETB= 3 Rupee
5. Modify the above program(4) so that the program will allow you to read the input and display
equivalent conversion without re-running it again!

You might also like