|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
Need Coding Help (Java)
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |||||||||||||
|
Console Gamer
|
Hey, im writing code for my uni class, and im havening a bit of trouble keeping it organized. Its a simple program that takes in scores and returns the score you got in the class.
My problem is splitting the program up into methods. I cant seem to find any way that works well. And my main is becoming cluttered up. The only ways I though of is doing a examMath one and a homeworkMath one, or doing an input, math, output one (doent work). So im stumped. Heres the expected output. Quote:
__________________
.999... = 1 Get over it.
Learn to do some bloody math without a calculator. "Video games don't make people violent, coding video games makes people violent." 3800+ X2 O/C
Last edited by Danavas : 04-27-07 at 10:38 AM. |
|||||||||||||
|
|
|
|
|
#2 (permalink) | ||||||||||||||
|
Turing Test is Overrated
|
What language? BASIC? What version?
__________________
WANTED: Socket M Core/Core 2 CPU, SUGO-02 Black, quality 802.11b/g PCI Card To answer most of your questions: (1) a fridge cannot cool a PC (2) 64-bit OS for over 3.4GB (3) If a PCIe card fits, it will work (4) Resolution, not screen size (5) If you have a question, it is not news (6) Report, not respond to Spam (7) Single/Non-Modular Rail PSUs are NOT better than Multi-Rail/Modular Quote:
|
||||||||||||||
|
|
|
|
#3 (permalink) | |||||||||||||
|
Console Gamer
|
Its Java, but I really just need help structuring it into methods, I cant find any good places to break it up Heres a link to the assignment if ya like.
http://www.cs.washington.edu/educati...hw4-grades.pdf Also this is what I have so far, but its kinda a mess. Quote:
__________________
.999... = 1 Get over it.
Learn to do some bloody math without a calculator. "Video games don't make people violent, coding video games makes people violent." 3800+ X2 O/C
Last edited by Danavas : 04-27-07 at 10:33 AM. |
|||||||||||||
|
|
|
|
|
#4 (permalink) | ||||||||||||||
|
Turing Test is Overrated
|
Do they want you to use Object Oriented design?
If so, you need to create class and have the different calculation methods within the class.
__________________
WANTED: Socket M Core/Core 2 CPU, SUGO-02 Black, quality 802.11b/g PCI Card To answer most of your questions: (1) a fridge cannot cool a PC (2) 64-bit OS for over 3.4GB (3) If a PCIe card fits, it will work (4) Resolution, not screen size (5) If you have a question, it is not news (6) Report, not respond to Spam (7) Single/Non-Modular Rail PSUs are NOT better than Multi-Rail/Modular Quote:
|
||||||||||||||
|
|
|
|
#5 (permalink) | ||||||||||||
|
Console Gamer
|
I more need ideas for how i can break up the work. Im really not seeing it on this assignment. I though if i just started writing it id get an idea, but that hasn't been the case. About 5 hours ago the main was a horrible mess. Its still pretty bad as you can see above.
__________________
.999... = 1 Get over it.
Learn to do some bloody math without a calculator. "Video games don't make people violent, coding video games makes people violent." 3800+ X2 O/C
|
||||||||||||
|
|
|
|
|
#6 (permalink) | |||||||||||||||
|
Turing Test is Overrated
|
Quote:
http://www-128.ibm.com/developerwork...ary/j-dyn0429/ In this code, you creat a class or object that can do things. You create and use the class Demo. If you need the class to do more things, you write a method and place the method in class definition. Code:
public class Demo
{
public static void main(String[] args) {
System.out.println("**beginning execution**");
Greeter greeter = new Greeter();
System.out.println("**created Greeter**");
greeter.greet();
}
}
public class Greeter
{
private static Message s_message = new Message("Hello, World!");
public void greet() {
s_message.print(System.out);
}
}
public class Message
{
private String m_text;
public Message(String text) {
m_text = text;
}
public void print(java.io.PrintStream ps) {
ps.println(m_text);
}
}
__________________
WANTED: Socket M Core/Core 2 CPU, SUGO-02 Black, quality 802.11b/g PCI Card To answer most of your questions: (1) a fridge cannot cool a PC (2) 64-bit OS for over 3.4GB (3) If a PCIe card fits, it will work (4) Resolution, not screen size (5) If you have a question, it is not news (6) Report, not respond to Spam (7) Single/Non-Modular Rail PSUs are NOT better than Multi-Rail/Modular Quote:
|
|||||||||||||||
|
|
|
|
#7 (permalink) | ||||||||||||
|
Console Gamer
|
I honestly think my code is garbage too. Normally I sort everything up on my notepad first and then write it having an idea what methods ill write and what they will do. But im not really seeing any kinda pattern. Id rewrite it if I had a better idea of how to accomplish it more efficiently.
Also if I use things we haven't 'learned' yet, I get in trouble. I got yelled at for trying to use an array already. Were only suppose to have one class I believe.
__________________
.999... = 1 Get over it.
Learn to do some bloody math without a calculator. "Video games don't make people violent, coding video games makes people violent." 3800+ X2 O/C
Last edited by Danavas : 04-27-07 at 11:02 AM. |
||||||||||||
|
|
|
|
|
#8 (permalink) | |||||||||||||||
|
Turing Test is Overrated
|
Quote:
Weights Homework Exam FinalGrade
__________________
WANTED: Socket M Core/Core 2 CPU, SUGO-02 Black, quality 802.11b/g PCI Card To answer most of your questions: (1) a fridge cannot cool a PC (2) 64-bit OS for over 3.4GB (3) If a PCIe card fits, it will work (4) Resolution, not screen size (5) If you have a question, it is not news (6) Report, not respond to Spam (7) Single/Non-Modular Rail PSUs are NOT better than Multi-Rail/Modular Quote:
|
|||||||||||||||
|
|
|
|
#9 (permalink) | |||||||||||||
|
Apple Doesn't Love You
|
Here is the method I would use. Change whatever your teacher wouldn't like
Put weights into double vars Get number of homework Loop and add the score/max to their own respective vars Calculate HW percentage For the exams: Get score Get curve Apply curve Get Exam percentages Add the three percentages and apply weight
|
|||||||||||||
|
|
|
|
#10 (permalink) | ||||||||||||
|
Console Gamer
|
thanks guys
__________________
.999... = 1 Get over it.
Learn to do some bloody math without a calculator. "Video games don't make people violent, coding video games makes people violent." 3800+ X2 O/C
|
||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|