File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes i want some help in writing the code for the below description Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "i want some help in writing the code for the below description" Watch "i want some help in writing the code for the below description" New topic
Author

i want some help in writing the code for the below description

charan kumar neela
Greenhorn

Joined: Mar 15, 2008
Posts: 7
hi all,
i want some information regarding the blueJ software which is used to compile and execute an java file and i need some coding for the java programmes which i will sent to you and i want that coding so that i can use it in blueJ to execute so any one interested can send me their email ID so that i can attach my file to them for writing code.
the brief description about the programme is :
The first class to consider is Team. This will hold the data on a single team. The data held will be the name of the team, the number of wins, the number of draws and the number of losses for that team. It should have a single constructor that will set the team name and initialise the numeric values. It will provide getter methods for the attributes. It should also be possible to update the numeric attributes to record the results of a game. Note that the only way to set the team name must be via the constructor � once set it cannot be changed. Our next class is League. This maintains a list of teams in the league. Its attributes will be the name of the league and a list of team objects. You may decide how you store the list of teams. You should provide a constructor which takes the name of the league as a parameter. The constructor should be kept simple. There will be a method to add teams to the league. Another will search for a given team and return the team if it is found otherwise it should return null. There will also be a method to record the result of a match between two teams. This method should take three parameters: the home team name, the away team name and the result for the home team. The result should be a string: �win�, �draw� or �pass�. (Note : if you feel confident you may investigate Java enum). You should also provide a toString method that returns the name of the league and the team details in the form of a league table. (NOTE: you do not need to have sorted the league. This point will be looked at later) NOTE: neither Team nor League have any methods that deal with input or output. It is good object oriented programming practice to separate the I/O from the business classes This brings us to the class LeagueFactory. It has one task: to create a League object. It will do this by means of a method public League createLeague(). This method will collect the necessary data from the user, create and return a new league object. The name of the league should be entered followed by the name of each tea, one name per line. The main I/O for the program is to be contained in the class Controller. This class is expected to have the following attributes: a Scanner and a League. The Controller object will need to know about the league. There will be a menu method to permit the user to interact with the program. The menu will provide four options: Quit exit the program Team get the results for a single team All output the league Result record the result of a match

You will need to write some simple code along the following lines:


get command while ( command is not quit)
{
if command first command process first command
else if
command second
command process
second command �.
get command
}

The final class is LeagueDriver. This class contains the main method which should merely be used to fire off the program.
Note on the All command
It is acceptable to simply output the league in a none sorted order, i.e. as it is recorded in your league list. However, extra marks are available for outputting the league in rank order. Rank order is defined by the number of points a team has: 3 for a win, 1 for a draw and 0 for a loss. In order to output the league in rank order you will need to do a little independent research into the Comparable Interface, and the compareTo method, and the support Java provides for sorting ArrayLists or Arrays.

thanking you

yours sincerely,
NEELA CHARAN KUMAR
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41800
    
  62
This looks like homework you're supposed to be doing. We don't want to deprive you of the opportunity to learn something (JavaRanch is all about learning), so let's turn the question around: What thoughts do you have on the matter, and where are you stuck implementing it?

Also, you should read DoYourOwnHomework and ShowSomeEffort, as well as the other hints on how to get the most out of JavaRanch: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch


Ping & DNS - my free Android networking tools app
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
I agree with Ulf, you must do your own work. When given a list of requirements, it may help if you break the problem down into small pieces. See if you can get the following block of code to compile and print true:



Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
charan kumar neela
Greenhorn

Joined: Mar 15, 2008
Posts: 7
Originally posted by Garrett Rowe:
thanks a lot but i am from electronics background and i have joined in computer background at newcastle college in U.K and i am facing a lot of difficulty in doing this problem as i was not having this subject in my degree thats why i have posted this question and could you please frame all the required classes and constructors for me so that i can prepare documentation part on my own as i have two days for completion of my project and it is very new subject for me so i am asking for coding. thank you very much for helping me as i am learning java right now .[QB]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34


could you please frame all the required classes and constructors for me so that i can prepare documentation part on my own as i have two days for completion of my project and it is very new subject for me so i am asking for coding.


No, sorry. No one here will do this. As we said, we're not interested in helping you cheat. Now, if you want to give it a try yourself, and post your work, we'd be glad to help you by correcting and critiquing it. Otherwise, this is goodbye.


[Jess in Action][AskingGoodQuestions]
charan kumar neela
Greenhorn

Joined: Mar 15, 2008
Posts: 7
can you please make necessary correction for the below coding for which i have send you the description before


[ EJFH: Don't use the "quote" button, but the "reply" button instead! ]
[ March 16, 2008: Message edited by: Ernest Friedman-Hill ]
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18824
    
  40

can you please make necessary correction for the below coding for which i have send you the description before


No... But you can do it. Let's take a look at what you did so far...


The first class to consider is Team. .... done

This will hold the data on a single team. The data held will be the name of the team, the number of wins, the number of draws and the number of losses for that team. ... looks mostly done (okay for now)

It should have a single constructor that will set the team name and initialise the numeric values.

This is you next step. Please take a shot at doing this. And if you can't please elaborate the issue you are having.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
Look at your instructions.

The first class to consider is Team. This will hold the data on a single team. The data held will be the name of the team, the number of wins, the number of draws and the number of losses for that team. It should have a single constructor that will set the team name and initialise the numeric values. It will provide getter methods for the attributes. It should also be possible to update the numeric attributes to record the results of a game. Note that the only way to set the team name must be via the constructor � once set it cannot be changed.


One thing you must do in the Team constuctor is to initialise the variables.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
charan kumar neela
Greenhorn

Joined: Mar 15, 2008
Posts: 7
Originally posted by Henry Wong:


where to initialize the team name and can you please reply how to do this as this is the first time i am doing java programming and i am facing a lot of difficulty in creating the team, league,controller class
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30506
    
150

Originally posted by charan kumar neela:
where to initialize the team name and can you please reply how to do this as this is the first time i am doing java programming and i am facing a lot of difficulty in creating the team, league,controller class

As stated above, you should initialize the team name in the constructor. Can you identify the constructor in your code?

We understand that you are new to Java programming. The reason you are getting the answer in little pieces is to help you learn.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
charan kumar neela
Greenhorn

Joined: Mar 15, 2008
Posts: 7
Originally posted by Jeanne Boyarsky:

Really I am new to this programming that why i am asking for this and this is just a class work which does not give any marks but will give an idea of how to write the coding thatswhy i am asking for the java code, can you please send me the coding for one class so that i can frame for the other class also. thanking you.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41800
    
  62
This is not how JavaRanch works. Nobody here will do programming for you. But we'll try to help you get it done once you have shown that you have put some effort into it. You will learn much more that way, which is the goal of JavaRanch.
charan kumar neela
Greenhorn

Joined: Mar 15, 2008
Posts: 7
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41800
    
  62
What kinds of errors? If there were compile-time or runtime errors, post them here.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18824
    
  40

i have tried and done some coding but i am facing some errors while executing it can [you] try



Okay, what coding have you tried? And what errors are you facing?

Or basically, if you tell us where are you stuck, we can help you get unstuck. Tell us exactly what you did. And the errors you are facing. If you provide enough details, we can give you a hint in the right direction.

Henry
Umair Ejaz
Greenhorn

Joined: Jun 21, 2008
Posts: 2
Originally posted by charan kumar neela:
[QB][/QB]

Hi ,
I have same assignment and I am also new to Java but i dont have issue in implementing this assignment as i already worked at C++ for more than three years. but here the issue is the design diagram which my instructor mailed me with this problm is cofusing me
Please inform me if this is a correct diagram for this problem or not.
If this is corract then please just explain me this diagram.I will be thankfull to you
[ June 21, 2008: Message edited by: Umair Ejaz ]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38756
    
  23
Originally posted by Umair Ejaz:

Hi ,
I . . . dont have issue in implementing this assignment as i already worked at C++
Welcome to JavaRanch.

Beware: Java is not C++ and C++ is not Java and Java is not an extension of C++. Lots of people who have worked in C++ think the similarities in syntax mean there are similarities in the language and they don't realise that "protected" and "static" mean different things. There are other major differences.

Notice the original poster was warned we are not able to do homework for other people.

Apart from the fact that you have "attributes" and "operations" on that UML diagram where the Java custom would be to write "fields" and "methods": you are going to have to read what your lecturer said on the e-mail with that diagram; it may be that this UML diagram represents the required classes for your assignment. If so, then failing to follow the diagram will lose you lots of marks. You also need to find out whether completing the UML diagram is part of the assignment.

Reading the original post, yes, it appears that UML diagram does correctly describe the assignment. I could copy and paste the original post as an explanation if you wish . . .
Umair Ejaz
Greenhorn

Joined: Jun 21, 2008
Posts: 2
thanks dear for informing me regarding syntax.As i already told i am not asking for solution.Instructor mailed me the same exatly same statment with this diagram,which is originally posted.I cant have contact with instructor for next two days.So please answer my few questions about design diagram,I will be thankfull to you
1)which class will get the input from user,League factory class or controller class.I think ,there sould be a parameter of controller class in creatLeague() of LeagueFactory which wil take the input from user if this is the case then why controller class is assosiated with league driver calss?
2)If controller class obeject used from LeagueDriver class then to whome it will send the data?in LeagueFactory's object???if yes then why there is a creatleague funtion in LeagueFactory as creat command is already been sent from League diver class to controller class and there is no relation in LeagueDriver class and LeagueFatory class...then from where the function of creatleague will be called?
please
[ June 21, 2008: Message edited by: Umair Ejaz ]
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18824
    
  40

The problem statement is incredibly detailed -- in fact, it is a bit too detailed as you will never encounter that from an actual client.

It may be better to implement the classes in the order that it is described.

Henry
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38756
    
  23
Originally posted by Henry Wong:
It may be better to implement the classes in the order that it is described.
Not "may be"; if you are given such a detailed description in an assignment, you must implement it as described, or you will lose marks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: i want some help in writing the code for the below description