Skip to main content

Posts

Showing posts from February, 2017

Backward and Forward Asterisks

Hi, Have a happy Sunday. Today I'm going to explain, how to deal with asterisks problems.

Just before the day, I've been attend the interview.

Question:
To print out Asterisk (*) in system console in specific order.
*****
****
***
**
*

This is backward asterisks, I'm failed to do that, because of less time, no test cases and unfortunate system freezes. Yeah, this is not accept by recruiters. It's very simple problem, I know.

Anyway 15 minutes passes by. No clues.

I'm going to give the answer by two ways here now.
1. Backward Asterisks
2. Forward Asterisks

Solution:

public class Asterisks{
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner scan = new Scanner(System.in);
        System.out.println("Enter the number of rows : ");
        int n = scan.nextInt();
        System.out.println("Backward Asterisks");
        for (int i = n; i >=0; i--) {
 …

Vending Machine Task - Java

Hi, Happy Weekends. Most boring thing is every time you've been asked same questions or you've been requested to do same tasks in different ways. I faced a lot.

In IT field, It's happens for everyone at least one time. Don't be sad, It's a good practice and helpful. We can also prove our self to do same works in different ways, It's a kind of practice. It's a kind of strategy.

In earlier times, Most of times in interview, I getting the calculator tasks in Android. Yeah, I do successfully in each time.

Here I come to explain the Vending Machine Task in Java. I've asked for this task for three times in a row now, each time differently.

What is Vending Machine?
A vending machine is a machine that dispenses items such as snacks, beverages, alcohol, cigarettes, lottery tickets to customers automatically, after the customer inserts currency or credit into the machine.

How it's works?
Vending machine is having a different product items with different deno…