Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8634517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:44:39+00:00 2026-06-12T09:44:39+00:00

I know this is just a simple java array problem, but I don’t have

  • 0

I know this is just a simple java array problem, but I don’t have any idea how to do this.What I want to do is like this:

Student    Score    Graph
John                3    ***
Mark                2    **
James              1    *

What I have in mind is an array like this:

String[][] students = { { "John", "Mark", "James" }, { "3", "2", "1" } };

How will I print the line graph without adding another set of variables in the array? I want it to just display asterisks (*) according to the number of score.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:44:40+00:00Added an answer on June 12, 2026 at 9:44 am

    You can do something like below

        String[][] students = { { "John", "Mark", "James" }, { "3", "2", "1" } };
        for (int i = 0; i < students[0].length; i++) {
            StringBuilder asterix = new StringBuilder();
            for (int acnt = 0; acnt < Integer.parseInt(students[1][i]); acnt++)
                asterix.append("*");
            System.out.printf("%s\t%s\t%s", students[0][i], students[1][i],asterix.toString());
            System.out.println();
        }
    

    Output

    John    3   ***
    Mark    2   **
    James   1   *
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably quite simple, but I just don't know how to do this...
I don't know how to explain this correctly but just some sample for you
I know this may seem like a math question but i just saw this
Say I have a simple PHP loop like this one // Bad example $array
I know this is simple, I just can't recall the best way to do
I know this is going to be something simple that I'm just missing somehow,
I know this is easy but i m just not able to debug it.
I know this sounds confusing: I have just built some basic prev/next pagination for
i know this is kinda retarded but I just can't figure it out. I'm
I know this has been asked thousands of times but I just can't find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.