• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help me Solve This Ep 2 TAT  RSS feed

 
mare san
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The coding given ;A;

public class WarningMain
{
public static void main (String[]args)throws IOException
{
String me;
BufferedReader input =new BufferedReader ( new InputStreamReader(System.in) );

System.out.print("Your name:");
me = input.readLine();

Warning cd = new first ( me );
cd.display();

Warning cd1 = new second ( me,6);
cd1.display();

Warning cd2 = new Bar (me,"WILL STUDY HARD !");
cd2.display();

}
}

Please Kindly Help me solve This ToT /

 
Liutauras Vilda
Sheriff
Posts: 4928
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Do you have any questions?

If you do have questions, please include them in your thread.
Beside that, help audience to decipher "Ep 2 TAT" and "ToT".

And it is also worth and important for you to go through this > HowToAskQuestionsOnJavaRanch

 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please show us what you have got so far. We don't supply solutions like that one, but will happily comment on what you show us.
Start by telling us what you think the question means. Then identify the unjustified assumption made in the code posted.

Your photo does not show up, but I copied the link: this appears to be it. Please post text rather than photos. Please avoid the obscure abbreviations and emoticons like TAT/, which some people will find difficult to understand.
 
mare san
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roger
Image-(2).jpg
[Thumbnail for Image-(2).jpg]
this one hopefully u guys can see :-o
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what have you tried? Did you find the unjustified assumption?
 
mare san
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They need to show the output (System.out.print) by using inheritance and constructor right campbell ?
 
mare san
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
help me guys , gimme the guides , im really wanna learn this .
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't really help you if you don't tell us what the expected output is.

BTW, if this is your coursebook, it is horrible. Bad names, bad indentation, bad way to teach the stated goals.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you have to create classes called first second and Bar (as Junilu says, dreadful names) with a method to print such warning messages. So you need three classes which print four messages between them (has somebody counted them wrongly?). There are other instructions about inheritance which you need to comply with, too.

The first version of the link wouldn't open for me so I struck it out, but the second version shows me that AMIN hasn't done any work and AMIN WILL STUDY HARD!

I thought the 6 meant to take the first 6 letters of the name, but it may mean that you send the second warning after 6 hours missed.
 
Ash Jon
Greenhorn
Posts: 16
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mar_san, do you know the topics in the assignment question? (Abstract classes, parametrised constructors and Inheritance)

If you don't, it is imperative you learn these.

That being said, I will give a quick overview of what it is really asking you and how it relates (I'm not going to code it for you though, you really REALLY need to research and understand this).


You have three reference variables of type object Warning (cd, cd1 & cd2). You can see from the code that they don't explicitly reference an object of that type, which tells you that each class object (first, second & Bar) is a subclass of Warning (Inheritance).
You can also see that each of these has a display() method (Abstraction Method). Each of these are subclasses of Warning, so Warning defines the method (Abstraction), then the child classes implement them.
You can also see that when each new child class of Warning is created, they are passed parameters for which a constructor needs to be defined to handle it. For example, new second(me, 6): the constructor for the class second is passed a String and and an int literal (me is of type String). you should be able to work out from the code I provided you with yesterday for your last question, how to implement these constructors.

An abstraction example:



It really is a shame that these questions are so badly designed... and people get paid to do it! That's even more annoying

Hope it helps
 
mare san
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok Thank you guys . I Try
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!