Results 1 to 2 of 2
  1. #1
    snobbysteven is offline Member
    Join Date
    Oct 2012
    Posts
    17
    Rep Power
    0

    Exclamation Graphing with Astricks

    I have everything done but the assignment is to also graph how many numbers of each grade there were using Astricks, Any help would be appreciated :)

    //Ass5ID0000
    //


    public class Ass5ID0000
    {
    public static void main(String[] args)
    {
    GradeDistribution g1;
    g1 = new GradeDistribution();


    System.out.println("enter how many of each grade were given, and your total will be displayed at the end");

    System.out.println("how many A's were given?");
    g1.setNumberOfAs();

    System.out.println("how many B's were given?");
    g1.setNumberOfBs();

    System.out.println("how many C's were given?");
    g1.setNumberOfCs();

    System.out.println("how many D's were given?");
    g1.setNumberOfDs();

    System.out.println("how many F's were given?");
    g1.setNumberOfFs();

    System.out.println("heres your total amount of grades " + g1.getTotalNumberOfGrades());

    System.out.println("here are the percentages for each grade:");
    System.out.println("A = " + g1.getPerCentA() + "%");
    System.out.println("B = " + g1.getPerCentB() + "%");
    System.out.println("C = " + g1.getPerCentC() + "%");
    System.out.println("D = " + g1.getPerCentD() + "%");
    System.out.println("F = " + g1.getPerCentF() + "%");

    System.out.println("here are the grades graphed out as well");
    System.out.println(g1.DrawGraph());
    }
    }


    //Assignment 6
    //Grade Distribution

    import java.util.*;

    public class GradeDistribution
    {
    Scanner keyboard = new Scanner(System.in);

    public int A,B,C,D,F;
    public int gradepercent;
    String ASTRTISK = "*";
    public int index = 0;

    //set number
    public void setNumberOfAs()
    {
    A = keyboard.nextInt();
    return;

    }

    public void setNumberOfBs()
    {
    B = keyboard.nextInt();
    return;
    }

    public void setNumberOfCs()
    {
    C = keyboard.nextInt();
    return;
    }

    public void setNumberOfDs()
    {
    D = keyboard.nextInt();
    return;
    }

    public void setNumberOfFs()
    {
    F = keyboard.nextInt();
    return;
    }

    //get number

    public int getNumberOfAs()
    {
    return A;
    }
    public int getNumberOfBs()
    {
    return B;
    }
    public int getNumberOfCs()
    {
    return C;
    }
    public int getNumberOfDs()
    {
    return D;
    }
    public int getNumberOfFs()
    {
    return F;
    }
    public int getTotalNumberOfGrades()
    {
    return A+B+C+D+F;
    }

    //Draw Graph


    public String DrawGraph()
    {
    while (index <= A);
    System.out.print(ASTRTISK);
    return ASTRTISK;
    }




    //get percentage

    public double getPerCentA()
    {
    return(((double)A/(double)getTotalNumberOfGrades())*100d);
    }
    public double getPerCentB()
    {
    return(((double)B/(double)getTotalNumberOfGrades())*100d);
    }
    public double getPerCentC()
    {
    return(((double)C/(double)getTotalNumberOfGrades())*100d);
    }
    public double getPerCentD()
    {
    return(((double)D/(double)getTotalNumberOfGrades())*100d);
    }
    public double getPerCentF()
    {
    return(((double)F/(double)getTotalNumberOfGrades())*100d);
    }








    }

  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Graphing with Astricks

    Hello and welcome! Please use [code][/code] tags when posting code so we can easily read it!

    Forum Rules
    Guide For New Members
    BB Code List - Java Programming Forum

    That said, what have you tried with regard to graphing so far?

Similar Threads

  1. Need help graphing
    By rperalta in forum Java 2D
    Replies: 6
    Last Post: 09-24-2011, 05:59 PM
  2. Graphing GUI
    By spyroth in forum NetBeans
    Replies: 3
    Last Post: 02-12-2011, 02:52 AM
  3. Scientific Graphing
    By shruthi Nadiger in forum AWT / Swing
    Replies: 2
    Last Post: 03-14-2010, 11:37 PM
  4. Graphing in java
    By collin389 in forum New To Java
    Replies: 2
    Last Post: 01-18-2010, 01:54 AM
  5. Help with graphing problem
    By adlb1300 in forum New To Java
    Replies: 2
    Last Post: 11-26-2007, 02:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •