Constructor problem


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Constructor problem
# 1  
Old 09-05-2006
Constructor problem

Hi guys I am new to these forums but since I am taking a class at college I would appreciate any help that is possible for this program. My instructor said that when its complete the program should be able to store all 3 fields instead of just 1.

public class Greeter2Test
{
public static void main( String[] args)
{
Greeter terse = new Greeter ( "Hello, ", "Goodbye, ", "Dave" );
Greeter verbose = new Greeter ("How are you, ", "Have a nice day, ", "Hal");

System.out.println( terse.sayHello() );
System.out.println( verbose.sayHello() );
System.out.println( verbose.sayGoodbye() );
System.out.println( terse.sayGoodbye() );
}
}
Im not sure what it is that I am supposed to edit to make it work properly
The error I get is cannot find symbol. But I cant see which symbol it means or what exactly it is that I am misssing any help would be most appreciated.
# 2  
Old 09-05-2006
Quote:
Originally Posted by woot4moo
Hi guys I am new to these forums but since I am taking a class at college I would appreciate any help that is possible for this program. My instructor said that when its complete the program should be able to store all 3 fields instead of just 1.

public class Greeter2Test
{
public static void main( String[] args)
{
Greeter terse = new Greeter ( "Hello, ", "Goodbye, ", "Dave" );
Greeter verbose = new Greeter ("How are you, ", "Have a nice day, ", "Hal");

System.out.println( terse.sayHello() );
System.out.println( verbose.sayHello() );
System.out.println( verbose.sayGoodbye() );
System.out.println( terse.sayGoodbye() );
}
}
Im not sure what it is that I am supposed to edit to make it work properly
The error I get is cannot find symbol. But I cant see which symbol it means or what exactly it is that I am misssing any help would be most appreciated.
I'm not sure what you mean - or what your instructor means. I don't see any place where it is taking a single input. And I don't know what he means by making it take three. You might post what that Greeter class contains.

How, may I also ask, is it related to Unix? Smilie
# 3  
Old 09-05-2006
Buddy you have missed the Greeter class definition and this question is related to Java.
# 4  
Old 09-05-2006
I apologize for being misguided in my previous question and to boot placing it in the wrong forum sorry Smilie
# 5  
Old 09-06-2006
Thread closed. Reason: Homework.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Programming

Constructor?

I am learning about C++ and today am reading concepts for Constructor but it seems a bit difficult to grab it fully. Please anyone explain in simple words about Constructor? (1 Reply)
Discussion started by: ggiwebsinfo
1 Replies

2. Programming

Doubts on C++ copy constructor concept

Hi, If I run the following program class A { public: A() { cout << "default" << endl; } A(const A&) { cout << "copy" << endl; } }; A tmp; A fun() { return tmp; } A test() { A tmp; cout << &tmp << endl; return tmp; } (1 Reply)
Discussion started by: royalibrahim
1 Replies

3. Programming

c++ object constructor question

I have the following code class Param{ public: Param(int aa, int bb){ a=aa; b=bb; } int a,b; }; void function(Param); int main(){ function(2,3); return 0; } (6 Replies)
Discussion started by: santiagorf
6 Replies

4. Programming

Doubt regarding Copy Constructor and return value

Hi All, I have made the simple following program :- #include <string> #include <iostream> using namespace std; class A{ private: int val; public : A(){cout<<"In A()"<<endl;} A (const A& aa) { cout<<"In copy c'tor"<<endl; } }; A f(... (1 Reply)
Discussion started by: shubhranshu
1 Replies

5. Shell Programming and Scripting

call constructor of java class in script

Hi, Is it possible to call the constructur of a java class in a shell script? I know you can call static methods, but can you also call the constructor? tnx. (1 Reply)
Discussion started by: thebladerunner
1 Replies

6. Programming

how do you handle a constructor and destructor that fail

helo i m new in c++ on linux can u tell me with an simple example that how do you handle constructor and destructor that fail? Regards, Amit (4 Replies)
Discussion started by: amitpansuria
4 Replies

7. Programming

why constructor cannot be virtual

helo i read many books but i cant find the proper answer that why constructor cannot be virtual can u explain me in simple term that why constructor cannot be virtual Regards, Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies
Login or Register to Ask a Question