Help in programming question. Bluej complier
Hi guys,
I desperately need help in these questions:
Write an application to: Print the cost of 25 boxes of apples. Each box of apples costs #12.17 The answer to be of the form:
The cost of the apples is #xxx
Write an application that takes as a command line argument a word and outputs how many character are in the word. If called with the command line arguments Computingand Freedomwould output: Computing has 9 characters Freedom has 7 characters
Write an application that takes as a command line argument a word and outputs how many vowels are in the word. A vowel is the letter a, e, i, o or u. If called with the command line arguments Computingand Freedomwould output: Computing has 3 vowels Freedom has 3 vowels
Write an application that takes as a command line argument a word and checks if it is a palindrome. A palindrome is a word which when written backwards is the same as when written normally. For example: civic and redder are palindromes. If called with command line arguments civicand historywould output civic is a palindrome history is not a palindrome
Re: Help in programming question. Bluej complier
Where are your questions? All I see are your assignment requirements.
Take them one at a time. Don't post more than one problem on one thread.
Be sure to show what you have done and ask questions about what you are having problems with.
Re: Help in programming question. Bluej complier
Hi Norm,
Thanks for your reply.
Okay one of the questions is :
1) Write an application to: Print the cost of 25 boxes of apples. Each box of apples costs #12.17 The answer to be of the form:
The cost of the apples is #xxx
I haven't done anything on this as I dont know how to do it.. thats basically the problem.
Thank You.
Rads
Re: Help in programming question. Bluej complier
Start simply. Write a program that prints:
The cost of the apples is #xxx
Where xxx is a number in a variable.
When you have that move on to the next part.
Re: Help in programming question. Bluej complier
Oh so basically,
public class apples{
public static void main(String[]args) {
system.out.printIn("The cost of the apples is #318.75")
}
} //end of class apples
is that correct or am i completely wrong lol?
R x
Re: Help in programming question. Bluej complier
Quote:
Where xxx is a number in a variable.
Put the 318.75 into a double variable and use that in the println
Also classnames should begin with a Capital letter
Re: Help in programming question. Bluej complier
As you can tell im not really good at Java, so im really confused...
could you give me an example as in what you mean please?
R x
Re: Help in programming question. Bluej complier
[QUOTE=Norm;38758]Put the 318.75 into a double variable and use that in the println
Sorry, could u explain what that means?
Re: Help in programming question. Bluej complier
var = 123.45;
System.out.println("some text " + var);
Re: Help in programming question. Bluej complier
it doesnt work,
i need to ask something else to the variable.
my coding i did was:
public class apples{
public static void main(String[]args) {
var= 3.18.75;
system.out.printIn("The cost of the apples is + 318.75");
}
} //end of class apples
you probably think im stupid for asking you all these stupid questions.... what am i doing wrong, whats the right coding?
thanks! R x
Re: Help in programming question. Bluej complier
Time for you to look at the Tutorials or your textbook. I'm not going to give you lines of code. You need to look at some programs and see how they are put together.
My example:
System.out.println("some text " + var);
your version:
system.out.printIn("The cost of the apples is + 318.75");
How many differences do you see between mine and yours?
Other than I said some text
instead of The cost of the apples is
Re: Help in programming question. Bluej complier
Re: Help in programming question. Bluej complier
That could be. Some things are harder than others. I have a hard time learning to play music.
Spend more time reading the Tutorials:
The Java™ Tutorials
Trail: Learning the Java Language: Table of Contents (The Java™ Tutorials)
The Really Big Index