Results 1 to 2 of 2
Thread: Help with assignment
- 10-20-2012, 06:01 AM #1
Member
- Join Date
- Oct 2012
- Posts
- 17
- Rep Power
- 0
Help with assignment
Here is the Assignment:
Call the class described in the assignment GradeDistributionID0000.java
Write a program Ass5ID0000.java ("0000" is your ID) that
creates an instance of GradeDistribution
tests all of the methods from your implementation of the GradeDistribution class.
None of the methods from the GradeDistribution class should prompt a user for input.
All prompting of a user should be done by the Ass5ID0000.java program which should use the set methods from the GradeDistribution class to put data into a GradeDistributionID0000 object.
Your class should have the following methods.
setNumberOfAs()
setNumberOfBs()
setNumberOfCs()
setNumberOfDs()
setNumberOfFs()
getNumberOfAs()
getNumberOfBs()
getNumberOfCs()
getNumberOfDs()
getNumberOfFs()
getTotalNumberOfGrades()
getPerCentA()
getPerCentB()
getPerCentC()
getPerCentD()
getPerCentF()
drawGraph()
------------------------------------
heres what I have so far, but im not sure how to bring the methods and statements from Grade over to the Ass5ID side.
Java Code://Ass5ID0000 //Main method import java.util.*; public class Ass5ID0000 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("how many A's were given?"); GradeDistribution.A = keyboard.nextint(); } }Java Code://Assignment 6 //Grade Distribution public class GradeDistribution { public int A,B,C,D,F; public void setNumberOfAs() { return; } public void setNumberOfBs() { return; } public void setNumberOfCs() { return; } public void setNumberOfDs() { return; } public void setNumberOfFs() { return; } 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; } public int getPerCentA() { return (A/(A+B+C+D+F)*100); } public int getPerCentB() { return (B/(A+B+C+D+F)*100); } public int getPerCentC() { return (C/(A+B+C+D+F)*100); } public int getPerCentD() { return (D/(A+B+C+D+F)*100); } public int getPerCentF() { return (F/(A+B+C+D+F)*100); } }Last edited by pbrockway2; 10-20-2012 at 06:19 AM. Reason: code tags added
- 10-20-2012, 06:24 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,561
- Rep Power
- 11
Re: Help with assignment
Hi snobbysteven, welcome to the forums! I have added "code" tags to your post. The idea is that you put [code] at the start of a section of code and [/code] so that the code appears correctly formatted and readable.
You haven't done that. That is to say your main() method does not use the "new" operator to create an instance of GradeDistribution. It's the first thing you were told to do and it should probably be the first line of the main() method.Write a program Ass5ID0000.java ("0000" is your ID) that
creates an instance of GradeDistribution
...
Similar Threads
-
Need Help with assignment
By Resurgam in forum New To JavaReplies: 5Last Post: 02-22-2012, 09:10 PM -
Need help with assignment.
By smileybear33 in forum New To JavaReplies: 2Last Post: 04-26-2011, 03:47 AM -
Help with an assignment
By aqeel2010 in forum New To JavaReplies: 5Last Post: 01-14-2011, 09:04 AM -
assignment
By mr.othman in forum New To JavaReplies: 4Last Post: 12-03-2010, 02:55 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks