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

    Mar 18, 2016, 05:20 AM
    Hi everyone . I am trying to solve a java program
    Name:  dd.png
Views: 135
Size:  13.2 KB

    Can I print this in java using loops ? THANKS
    CravenMorhead's Avatar
    CravenMorhead Posts: 4,532, Reputation: 1065
    Adult Sexuality Expert
     
    #2

    Mar 18, 2016, 07:13 AM
    Yes.

    create a 2d array that contains a mapping for each character and it's position.
    i.e. 1=b, 2=o, 0=' '.
    [1 2 2 0 0]
    [1 2 2 1 0]

    Then loop through each line and each character and, using a switch statement, print out the character:
    for(I=0 to lastLine){
    for(j=0 to lastChar){

    switch(map[i][j]){

    case 1:print('b');
    case 2:print('o');
    case 0:print(' ');
    default:
    }
    }
    print ('\n');
    }

    The is the pusedo code, the rest is up to you.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Java Program [ 0 Answers ]

I Cannot calculate the average per day of person I want my code like this: Student Daily spending Name Day 1 Day 2 Day 3 Day 4 Day 5 Day 6 Day 7 Average per person Joe Smith ...

Java program help!! [ 1 Answers ]

Dr.Java method and overloaded methods help in code? Write a program that uses two overloaded methods to calculate the monthly payment for a loan. The formula for calculating a payment is shown further down. Given that the user enters: - an annual interest rate such as 3.600%, which is the...

Java netbeans program- Connection between java and mysql,How to conn [ 0 Answers ]

which I wrote from a book but when I run it, it shows exception please give me the code to connect jlistbox to database when I click on btn1. btn coding should search "name" in database and shows all the names in listbox my coding: here-- r1,r2,r3 are radio btns and l1,l2,l3 are labels,...

Java Program [ 2 Answers ]

1) Code a java class for an Object SONG, that has as a minimum the following attributes:- SONG Title (a String) , SONG Group/artist (a String ), SONG genre (a String – “Pop”, “Jazz”, “Hard Rock” etc. SONG price (double), SONG duration (int number of seconds). Code all accessor and mutator methods...

Solve the in following java code [ 0 Answers ]

import java.io.*; class vowels { public static void main(String args)throws IOException { // this coding is to check the vowel letters BufferedReader s= new BufferedReader(new InputStreamreader(System.in)); String x; System.out.println("enter a letter"); (s.readLine());


View more questions Search