> gud day to you all............
> My name is Casper and i'm new to java. I only
> I only started learning java just a month ago...
> And my problem is that our teacher want us to
> t us to program the following problems. But i dont know
> how to make it.... could anyone help me with my problems
> PLEASE ??????
>
> a. Write an Application that displays a box, an oval, an
> arrow and a diamond using asterisks (*).
>
use for loops and System.out.print()
// Not tested but this should print you a box of
// length 4
for(int i = 0; i < 8; i++){
if(i == 4){
for(int j = 0; j < 4; j++){
System.out.print("\n*");
for(int k = 0; k < 3; k++){
if(k == 2){
System.out.println("*\n");
continue;
}
System.out.print(" ");
}
}
}else{
System.out.print("*");
}
}
Mess around with the above code for the arrow and the oval.
> b. Write an application that determines and display a
> group of integers (maximum 5 groups of integers and prints
> the largest and smallest integers in the group.
> Output:
> Group of integers: 4 30 -5 0 10
> Largest: 30
> Smallest: -5
These are simple logic statements (if/else).
algorithm:
store your numbers in an array.
int max_num = array[0];
for(int i = 0; i < array.length; i++){
if(max_num < array[i]){
max_num = array[i];
}
// By the end of the iteration, max_num will hold
// the largest number in the array.
}
do the inverse for the smallest number.
>
> OUR TEACHER TOLD US TO PROGRAM IT IN A VERY SIMPLE
> LE WAY...
> PLEASE HELP ME....... GOD BLESS TO YOU........