318 Posted Topics
Re: Did you accidentally paste the same thing twice? ![]() | |
Re: Are you serious? #1. What is a 'wed site'? #2. This is the C++ section. #3. What do you even mean? #4. If you want to learn java, there are many tutorials on the net, just use google. It only wants to help you. #5. No to anything else you … | |
Re: If you want the boolean to be accesible in both the if and the else statement, you need to define it above them. Just define it as [CODE]boolean buyIt;//make sure you look up scope of variables[/CODE] It defaults to false, so no need to initialise. Now, all you need to … | |
Re: But you just posted the steps you need to do, to solve that problem. I don't quite understand what you are asking. | |
Re: Look at the pattern. it prints a '*' 1,3,5,7 and 9 times. Then the reverse. | |
Re: You are not testing if the value is true in the while loop. [CODE]}while(again= 'y' || 'Y' );[/CODE] You need an extra = sign to test if values are true or false. [CODE]}while(again== 'y' || again== 'Y' );[/CODE] | |
| |
Re: Math.random() produces a number where 0 <= x < 1. Therefore, Math.random()*5, produces a number where 0<=x<5. (So it will pick an index from 0 to 4.). [CODE](int) (Math.random() * 5);[/CODE] The (int) Just casts the value of the random number to type int, doing this 'cuts' off any numbers … | |
Re: [QUOTE=Vllinator;1335046]This is a really good tutorial [url]http://xoax.net/comp/cpp/console/Lesson9.php[/url] If this is for a school project, be sure to not just copy the source code and make a few changes - you'll learn nothing that way. Goodluck[/QUOTE] Wow, thanks for that website, i have never seen it before! | |
Re: [url]http://leepoint.net/notes-java/flow/loops/loops.html[/url] Use spaces when you type in english. | |
Re: [CODE]#include "first.cpp" using namespace myNS;[/CODE] Does that solve it? | |
Re: Nice, I'm also from Ireland. Its a bit strange they don't give us keyboards to write our own language properly isn't it. Where is your fada? :D | |
Re: [QUOTE=notmasteryet;1334659]Lol... I kno that.[/QUOTE] Well then, Do you expect us to look into [B]your[/B] future, find out the different types of problems you will face in class, and explain them to you now? There is nothing more we can tell you about starting a program. It all depends on what … | |
Re: Your constructor has 2 arguments, you only enter 1. | |
Re: ERROR #1: In your constructor: [CODE] public BankAccount(String a, double b, double c)//You need to assign a variable to each type otherwise nothing is storing the value and it won't compile { } [/CODE] ERROR #2: [CODE]# public abstract void updateBalance(); { //You need to un-comment the braces and close … | |
Re: Your trying to compare letters, not numbers. [CODE]int select;//should be char or string[/CODE] [CODE]if(select.equals('Y')) {//return a value} if(no) {//return a value}[/CODE] | |
Re: Does it not work? Do you get errors? | |
Re: [url]http://msdn.microsoft.com/en-us/library/czs2584d.aspx[/url] Maybe this will help you. :) | |
Re: Why are you using a boolean? Your program doesn't even compile for me. Do you realise you are trying to assign 2 booleans to a single integer? | |
Re: Well, first of all, your withdraw method is wrong. You have: [CODE]if (withdraw >= balance)[/CODE] but you haven't initialised the withdraw variable. You don't even use it. | |
Re: [QUOTE=extemer;1332670]import javax.swing.*; import java.util.*; class stringdemo { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("enter num1\n"); int num1 = input.nextInt(); System.out.print("enter num2\n"); int num2 = input.nextInt(); System.out.print("enter num3\n"); int num3 = input.nextInt(); System.out.print("enter num4\n"); int num4 = input.nextInt(); System.out.print("enter num5\n"); int num5 = input.nextInt(); // you … | |
Re: What are you required to use? You can do this with simple println. Ok, you edited your post, It's useful to tell me that. | |
Re: Can you post all your imports so I can try and compile? edit: Doesn't matter. | |
Re: [url]http://download.oracle.com/javase/1.4.2/docs/api/java/util/Timer.html[/url] This next link may be of more use [url]http://www.java-forums.org/new-java/13301-beginner-create-countup-timer.html[/url] | |
Re: > // In this code example I assume that firstArray and secondArray are primitive array > // reference variables, and that and import java.util.Arrays; has been done. > if (Arrays.equals(firstArray, secondArray)) > System.out.println("The arrays are equal."); > else > System.out.println("The arrays are not equal."); Hmm, What exactly is that testing … | |
Re: You cannot import inside a class. Move the import statement all the way to the top, above your class declaration. Import statements should not be incased in any code, declare them above your code at all times. | |
Re: We refer to ourselves as Computer Literate, not Computer Geeks!! :) Welcome! | |
Re: [CODE]int range(int lower, int higher, int sum=0) { while (lower <= higher) { //do something ++lower; } return sum; }[/CODE] | |
Re: At line 22, you have an opening brace that does nothing. Remove that and it should remove alot of those errors. You have: [CODE]# double getAverage() [b][U]{[/U] remove this[/b] // compute average test grade return (test1 + test2 + test3) / 3; [/CODE] Then obviously replace the { with a … | |
Re: Maybe put it all in a do..while loop. This way, it will keep asking for input so you can press 1,2 etc multiple times. You will need an array or something similar to store the inputs though. Then at each case, it adds the food name to the array. | |
Re: //topClass.class [CODE][U]public[/U] topClass { class innerClass{//not public } class innerClass2{ } }[/CODE] | |
Re: You can just a have print message after the loop to tell the user your message, since the only way to break out of the loop is for a number to be negative. And then to make it continue you can do something like this: [CODE] boolean bEscape = true; … | |
| |
Re: Look at your invoice classes constructor. You are telling the program to set the Total to whatever the initialbalance is. [CODE]public Invoice( double initialBalance )//This means when you create a new //invoice object, it will need 1 argument of type double Invoice account1 = new Invoice(0.00);//You have initialBalance as 0, … | |
Re: [QUOTE=hehe31;1331049]can i ask the formulas for integer arithmetic?? it's because i'm still new to programming...[/QUOTE] [url]http://en.wikipedia.org/wiki/Arithmetic[/url] | |
Re: I have no idea how you have put up with him this far javaAddict. He clearly does not want to learn and clearly did not write that code himself. | |
Re: Well Its quite simple I believe, A char is a single character, that is a letter, a digit, a punctuation mark, a tab, a space or something similar. Therefore, if you want to find the ascii value of a number, you simple cast the number as a char. e.g. [CODE]System.out.print((char)+97); … | |
Re: Why did you bump a thread from 2004? Create your own thread if you needed help. | |
Re: You will need to accept an input from the user. Then simply compare that input for each grade. e.g. [CODE]if(input.equals("A")) { //..print the message for the A grade. } //etc... [/CODE] | |
Re: java -jar <MyJar.jar> ....(will only work for executable jar files. Not all jar files are executable) or if you still have a problem then it will most probably be a class path problem. If you still have a problem tell me. | |
Re: What is your problem? Can you compile? Do you get errors? If so, copy paste which errors you receive. | |
Re: >> How do I make this code generate a new pro when the "NEXT" button is pushed by Sir Saula in Java (Dec 7th, 2009) Sorry my friend but that is not 2 weeks of Java. It would be appreciated if you refrained from believing we have ape brains. Like … | |
Re: can you post the above code in the [CODE][/CODE] tags please. Its easier to see ![]() |
The End.