1
Lab 1:
1. Write and run the source code given below.
a. What is a class name?
b. What is a file name?
c. What is a main method?
d. What does [Link](“World!”) do?
1
2
2. Class, Object and void method
A posible class name Posible object
Image
names
1. Write a java
application
based on the
class name.
2. Inside the
class, create one
void method
named display.
The method will
print the name
of the image.
Example “This is
a Car”
3. Write one
application
named
[Link]. the
[Link]
consists main
method. Create
objects of four
classes and
invoke display
method in Main
method.
3. Complete the [Link] below.
package firstanalysis;
import [Link];
2
3
/**
*
* @author msa
*/
public class MyFirstAnalysis {
public int [] generateRandomData()
{
int inputData[] = new int[10];
Random
for(intgenerateRandom = new Random();
i =0; i<10; i++)
{
inputData[i] = [Link](100);
}
return inputData;
public void findMaxMinSumAverage(int [] inputData)
{
/*
* 1. Write your code to display Min, Max, Sum and Average Value
*
}
public static void main(String[] args) {
MyFirstAnalysis firstAnalysis = new MyFirstAnalysis();
for(int value : [Link]())
{
[Link]("Values : "+value);
}
}
}
4. Based on the UML class given below, write the java implementation class. Then, write
[Link] given below. Compile and run MyApp.
3
4
[Link]
5. Write one class named Temperature.
6. Inside the temperature class, write one method to convert farenheit to celcius.
Method Name public double convertTemperaturetoCelcius(double fahrenheit)
Input of method double
process celcius = (5.0/9)*(fahrenheit-32)
Output Temperature in celcius
4
5
After finish question 5 and 6, run the [Link] application below.
5
6
7. Add the related source code for converting farenheit to celcius into GuiTemperature class
below. Compile and run GuiTemperature.