Ask Experts Questions for FREE Help !
Ask
    elry's Avatar
    elry Posts: 1, Reputation: 1
    New Member
     
    #1

    Apr 25, 2015, 07:56 AM
    How to change the following codes to object oriented programming
    import java.util.Scanner;
    public class assign_star
    {
    public static void main(String[] args)
    {
    Scanner keyin=new Scanner(System.in);
    int number;

    do{
    System.out.print("number= ");
    number=keyin.nextInt();

    for(int row=1;row<=number;row++)
    {
    for(int col=1;col<=row;col++)
    {
    System.out.print("*");
    }
    System.out.println();
    }

    for(int row=number-1;row>=1;row--)
    {
    for(int col=1;col<=row;col++)
    {
    System.out.print("*");
    }
    System.out.println();
    }
    }while(number!=-1) ;

    }
    }

Check out some similar questions!

Object oriented design in java programming [ 0 Answers ]

I'm doing an object oriented design for players in a football match. My problem is : if here's a player and I want to apply game effects on him in different times of the game. For example, if he's in the field he's is "Motivated" so when I try to set his feelings (suppose I have a class named...

Object Oriented Programming language [ 0 Answers ]

Which is pure Object Oriented Programming language?

What is object oriented technology [ 2 Answers ]

What is an object oriented technology and there is any differences from object oriented programming ?

Object oriented [ 2 Answers ]

What is the difference b/w object oriented programming and oo design?


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.