BIC1224 Object Oriented Programming
Student Name: Jawad Hassan Khan
Student Id: 1002371785
Tutorial 1
Write the java programs for the following problems.
NOTE: THE CODE OF THE WHOLE TUTORIAL IS ON PAGE NUMBER 3.
1. Write a java application which display your name, your ID and program in separate lines.
2. (Display three messages) Write a program that displays “Welcome to OOP course”,
“Welcome to ICSDI”, and “Programming is fun”.
3. (Display five messages) Write a program that displays “Welcome to OOP course”
seven times.
Page 1 of 4
BIC1224 Object Oriented Programming
4. (Display a pattern) Write a program that displays the following pattern:
5. (Print a table) Write a program that displays the following table:
6. (Compute expressions) Write a program that displays the result of
Page 2 of 4
BIC1224 Object Oriented Programming
7. (Summation of a series) Write a program that displays the result of 1 + 2 + 3 + 4 + 5 + 6
+ 7 + 8 + 9.
8. Write a program that converts a Fahrenheit degree to Celsius using the formula:
celsius ( 95 )( fahrenheit 32)
CODE OF THE WHOLE TUTORIAL:
import [Link];
public class helloworld {
public static void main(String[]args){
[Link]("-----------Q1-----------");
[Link]("Name: Jawad Hassan Khan");
[Link]("ID: "+ 1002371785);
[Link]("Prefer Game: Badminton");
[Link]();
[Link]("-----------Q2-----------");
[Link]("Welcome to OOP course\nWelcome to ICSDI\nProgramming is fun");
[Link]();
[Link]("-----------Q3-----------");
for (int i = 0; i < 7; i++) {
[Link]("Welcome to OOP course");
}
Page 3 of 4
BIC1224 Object Oriented Programming
[Link]("-----------Q4-----------");
[Link]();
[Link](" J A V v A ");
[Link](" J A A V V A A ");
[Link](" J J AAAAA V V AAAAA ");
[Link](" J J A A V A A ");
[Link]();
[Link]("-----------Q5-----------");
[Link]("a a^2 a^3");
[Link]("1 1 1 ");
[Link]("2 4 8 ");
[Link]("3 9 27 ");
[Link]("4 16 64 ");
[Link]();
[Link]("-----------Q6-----------");
double expression = 0;
expression = (9.5 * 4.5 - 2.5 * 3)/(45.5-3.5);
[Link]("Answer to the expression = "+ expression);
[Link]();
[Link]("-----------Q7-----------");
int sum=0;
for (int i = 1; i < 10; i=i+1) {
sum=sum+i;
[Link](sum);
}
[Link]("-----------Q8-----------");
Scanner read = new Scanner([Link]);
[Link]("Enter the temperature in Fahrenheit: ");
double fahrenheit = [Link]();
double celsius = (fahrenheit-32.0)*(5.0/9.0);
[Link]("The temperature in celsius: "+celsius);
}
}
*Please copy all your work into one Microsoft word file and submit it via CN.
Page 4 of 4