Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will have to write one method in the GradeHistogram class The method should be called printDataRow It has two formal parameters A string for

You will have to write one method in the GradeHistogram class

  • The method should be called printDataRow
  • It has two formal parameters A string for the row label An int for how many asterisks are in the row
  • The method will print The string that was passed in followed by a colon and a space The asterisks (*) After the last asterisk it will print a newline Example: the statement: printDataRow("Number of As", 7); would output the following Number of As: *******
  • The class GradeHistogram is:
    • public class GradeHistogram { private String className; private int numAs; private int numBs; private int numCs; private int numDs; private int numFs; public GradeHistogram(String className, int numAs, int numBs, int numCs,int numDs, int numFs) { this.className = className; this.numAs = numAs; this.numBs = numBs; this.numCs = numCs; this.numDs = numDs; this.numFs = numFs; } public void setClassName(String name) { className = name; } public void setNumAs(int num) { numAs = num; } public void setNumBs(int num) { numBs = num; } public void setNumCs(int num) { numCs = num; } public void setNumDs(int num) { numDs = num; } public void setNumFs(int num) { numFs = num; } public String getClassName() { return className; } public int getNumAs() { return numAs; } public int getNumBs() { return numBs; } public int getNumCs() { return numCs; } public int getNumDs() { return numDs; } public int getNumFs() { return numFs; } public void printDataRow(String rowLabel, int numAst) { //answer goes here } public void printChart() { System.out.println("Class Name: " + className); printDataRow("Number of As", numAs); printDataRow("Number of Bs", numBs); printDataRow("Number of Cs", numCs); printDataRow("Number of Ds", numDs); printDataRow("NUmber of Fs", numFs); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

4. Describe the factors that influence self-disclosure

Answered: 1 week ago

Question

1. Explain key aspects of interpersonal relationships

Answered: 1 week ago