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

    Oct 22, 2013, 03:28 PM
    Need help for java code...
    Method called printGraph() that takes as a parameter an array of integers. Each
    integer will be between 0 and 100. The method should print a horizontally oriented bar graph of the values, using ‘=’ characters to produce bars. Each value should be divided
    By 10 and that many equals characters printed (so the maximum length of a bar will be 10 characters for a value of 100).
    The actual value of the bar should be printed following a space at the end of each line.
    So, for example, if the argument to printGraph() is { 14, 65, 39, 99 } then the output should look like this
    = 14
    ====== 65
    === 39
    ========= 99

    My answer was

    int printGraph(int [] args)
    {
    int size=0;
    int length, j;
    For(length = 1; length <= size; length++){
    For(j = 1; j <= length; j++)
    Print("=");
    Println(size);` ` `

    }
    Return length;
    }
    }

    Help me with codas...

Check out some similar questions!

Can somebody help me with Java code? [ 1 Answers ]

A method called dropItems() taking a Robot and an integer. The robot should (try to) drop that number of items. My version doesn't work unfortunately. Here is it: int dropBeepers(String input, int createRobot, int count) { count =0; ...

I want the java code please [ 2 Answers ]

Write a program that ask from the user how many integers you want to read then reads the set of integers from user, and then finds and prints the sum of even valued and odd valued integers . And also count how many even was entered by user and how many odd were entered by user.

Java code [ 2 Answers ]

Please give me a simple java code for addition of two numbers here two numbers are accepted From users please give me explanation about each code

Java code [ 2 Answers ]

Please give me a java program for additon of two numbers here nos are accepted from users here I am not confident about java program so please gieve me java code I only understand a hello program so please help me

Java code [ 1 Answers ]

What is difference between argument and parameter element as use in calling routines/coding a method? Can one use them interchangeably for talking/writing purposes?


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.