473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Beginner: Guru's Why want this complie

public class Hw5
{ public static void main(String[] args)

{ int x=10, y=12, z=8;
System.out.println("The largest of " + x + ", " + y + " and " + z + " is: "
+ getLargest(x,y,z));
System.out.println("The average of " + x + ", " + y + " and " + z + " is: "
+ getAverage(x,y,z));
char c1='a', c2='b', c3='u';
System.out.println(c1 + " is a vowel: " + isVowel(c1));
System.out.println(c2 + " is a vowel: " + isVowel(c2));
System.out.println(c3 + " is a vowel: " + isVowel(c3));
String s1="hello", s2="madam";
System.out.println(s1 + " is a palindrome: " + isPalindrome(s1));
System.out.println(s2 + " is a palindrome: " + isPalindrome(s2));
System.out.println(s1 + ": has " + countVowels(s1) + "vowels");
System.out.println(s2 + ": has " + countVowels(s2) + "vowels");
}

// write the getLargest method here that will receive 3 integers and return
the largest of them
// it starts like the following
public static int getLargest(int a, int b, int c)
{
if (a >= b && a >= c)
return a;
else if (b >= a && b >= c)
return b;
return c;
}
}
// write getAverage method here that will receive 3 integers and return the
average of them
// write isVowel method here that will receive a character and return "true"
if it is vowel, return "false" otherwise
// write isPalindrome method here that will receive a string and return
"true" if it is a palindrome, return "false" otherwise
// write countVowels method here that will receive a string and return the
number of vowels in the string



Jul 17 '05 #1
2 1899
JavaMan wrote:
public class Hw5
{ public static void main(String[] args)


- First off this class is is very incomplete. You make references to the
following methods but they do not exist:

getAverage()
isVowel()
isPalindrome()
countVowels()
- Then you have the following code that should be in methods but are not

if it is vowel, return "false" otherwise
"true" if it is a palindrome, return "false" otherwise

- Finally you 'class }' is out of place

You should slow down when you are doing your homework or pay more
attention to the class instructions. And definitely ask you teacher on
coding conventions you should follow when programming in Java. You are
not even close.
Thanks in Advance...
IchBin
__________________________________________________ ________________________

'Laughter is inner jogging'
- Norman Cousins, editor and author (1915-1990)
Jul 17 '05 #2
SMC
On Sat, 30 Oct 2004 12:24:00 +1000, JavaMan wrote:

<snip code>

Take baby steps "JavaMan", and learn to read and understand the compiler
errors. You won't get much help with your homework here unless you've
made a decent effort of it first.

--
Sean

"It is one of the essential features of [incompetence] that the person
so afflicted is incapable of knowing that he is incompetent. To have
such knowledge would already be to remedy a good portion of the
offense." --W.I. Miller
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: pmclinn | last post by:
Let's say I have the code below, and I want to complie this on a machine that does not have VS2003 installed on it, but does have the ..net framework... Is it possible to complie this code below,...
1
by: Maxwell | last post by:
Hello, I having having oodles of trouble using the std lib in my MC++ (VS.NET 2003) Class library. I figured out a simple sample to reproduce the errors I am having. Create a MC++ (VS.NET 2003)...
17
by: C_beginner | last post by:
Am I did the following program corectly according to the question? Question: /* 1:You have just been employed by MacroMuscle, Inc. (Software for Hard Bodies). The company is entering the...
1
by: Ranginald | last post by:
Hi, I have an asp.net project and I am in the process of trying to make it into a truly object-oriented project -- as I have just learned I cannot have multiple codebehind files in a single...
3
by: Michael Suess | last post by:
Hi, please feel free to correct me if this is the wrong group to ask this question. I have a blog about parallel programming and concurrency (http://www.thinkingparallel.com if you are...
8
by: subramanian100in | last post by:
Supoose we have, int x; int *p = &x; int *q; q = p + 1;
16
by: Singulus | last post by:
Hello all, I've searched for similar threads, I've found some bit of useful info here and there, but nevertheless I want to post my questions...So, how can I (we, in fact the forum can benefit...
0
by: =?Utf-8?B?SmFu?= | last post by:
Hi all, I've read about web services, xml rpc, soap, wsdl, uddi etc etc and I even have access to a company with some 6-7 web services that are running automated with some kind of biztalk...
13
by: jcato77 | last post by:
I am having trouble figuring out my code and was hoping someone could point me in the right direction. Below is my code what I need to due is create a method to add and display the value of the...
22
by: ddg_linux | last post by:
I have been reading about and doing a lot of php code examples from books but now I find myself wanting to do something practical with some of the skills that I have learned. I am a beginner php...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.