How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask LogicPro Your Own Question
LogicPro
LogicPro, Computer Software Engineer
Category: Programming
Satisfied Customers: 13041
Experience:  Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
29751445
Type Your Programming Question Here...
LogicPro is online now

I have 2 classes runner and matrathonAdmin the runner class

Customer Question

I have 2 classes runner and matrathonAdmin the runner class has variables name and ageGroup here is my question:
In the MarathonAdmin class write a public instance method called readInRunners() that takes no arguments and returns no value. The method will need to read from the file runners.txt, which can be found in the project folder for this question, and which contains the name and age of a number of runners in CSV format, like this:

XXXXX XXXXX,56
XXXXX XXXXX,24
XXXXX XXXXX,15
...

Note the comma delimiters. If you want to look at the file, use a text editor such as Notepad but make sure that you close the file without saving it.

The code for the method should do the following.

Prompt the user to select an appropriate text file.
Make use of BufferedReader and Scanner objects to read the file line by line.
As each line (which contains the name and age of a runner) is read, a new Runner object should be created and its instance variables set as follows.
▪ name can be set directly using the value from the file.

▪ ageGroup can be worked out from the given age: runners under 18 should be categorised as "junior" and those of 55 and older as "senior". All other entrants remain as "standard".

Your code may assume that all input provided is valid and you may find it helpful to introduce a local variable to help with the processing of age.

▪ Finally, the instance of Runner should be added to the list referenced by the instance variable runners.

In order to gain full marks you will need to ensure that the input file is properly closed by your method and also that it handles possible exceptions sensibly.

You can test your code by executing

MarathonAdmin ma = new MarathonAdmin();
ma.readInRunners();

. When prompted for a file you should select runners.txt. Having executed the method, you can use the inspector to inspect ma and check that its instance variable runners references a list of the runners created from the data in the text file, with correct names and age groups.
Submitted: 3 years ago.
Category: Programming
Expert:  LogicPro replied 3 years ago.
Hi
My Name is XXXXX XXXXX I will help you
If you have any file(s), Zip all files; upload the zipped file to http://wikisend.com or http://ge.tt and post download link here.
What is the deadline?
Expert:  LogicPro replied 3 years ago.
Hi
Download MatrathonAdmin.zip


Unzip to a real folder to get NetBeans project folder

If you are using netbeans:

Open NetBeans

Click on file->open project

Navigate to unzipped folder and click open

The project will be shown in left pane (project explorer)

Expand project by clicking [+]

Expand source packages by clicking [+]

Expand default package by clicking [+]

Right click on Test.java and click Run to get output

If you are NOT using netbeans:

You can use 3 java files from src folder and runner.txt from project folder

I have create toString() method in Runner.java and called it in readInRunners() method of MarathonAdmin.java to test if files is read properly

You can ask me again using "For LogicPro only" at the start of your questions like other customers to get instant answers.

It will ensure that question is for me.

Please bookmark my profile page:

http://www.justanswer.com/homework/expert-logicpro/

so you can come back and ask me a question anytime.

Remember, if for any reason you are unsatisfied with my answer, we can continue the conversation until you’re satisfied and rate my answer as excellent. I can address follow up questions on original requirements at no extra charge and I’m always here to help.

Thank you for using this site!

 

You can ask me again using "For LogicPro only" at the start of your questions like other customers to get instant answers.

It will ensure that question is for me.

Please bookmark my profile page:

http://www.justanswer.com/homework/expert-logicpro/

so you can come back and ask me a question anytime.

Remember, if for any reason you are unsatisfied with my answer, we can continue the conversation until you’re satisfied and rate my answer as excellent. I can address follow up questions on original requirements at no extra charge and I’m always here to help.

Thank you for using this site!

 


Customer: replied 3 years ago.

while try to compile i am getting a message cannot find symbol - add(runner)

Expert:  LogicPro replied 3 years ago.
Please provide me error screenshot?
Customer: replied 3 years ago.

while try to compile i am getting a message cannot find symbol - method add(runner)


How do i do that??

Expert:  LogicPro replied 3 years ago.

Which java IDE you are using?
Customer: replied 3 years ago.

bluej

Expert:  LogicPro replied 3 years ago.
Once you unzip the zip file, in the src folder, you will find the required java files.
Create a new BlueJ project. Add all the files in the project and run.
Customer: replied 3 years ago.

yes i added it all to bluej and when i compile this is the message which i get


cannot find symbol - method add(Runner)

Customer: replied 3 years ago.

yes i added it all to bluej and when i compile this is the message which i get

 

cannot find symbol - method add(Runner)

 

anyone there?

Customer: replied 3 years ago.

how do i take an error screenshot? maybe this could help

Customer: replied 3 years ago.

Im still trying to get answers to this question but no one is replying!

Customer: replied 3 years ago.

still no response

Expert:  LogicPro replied 3 years ago.

Hi,

I see you left bad rating without my mistake. It will affect my ratings. We expect if you need anything else, you would reply and wait. I was offline

Please wait while I provide BlueJ project

Expert:  LogicPro replied 3 years ago.
Download runner.zip

Unzip to a real folder to get BlueJ project folder
look for package.bluej and double click on this file to open in BlueJ
Right click on Test class symbol and click on main method. it will ask to provide arguments. Click on to run the file.
It will ask to enter file name to read. Enter runner.txt to get output

Reply if any issue or rate this answer as excellent
to override bad rating as it was not my mistake. All files are same as provided in previous answer
LogicPro and other Programming Specialists are ready to help you
Customer: replied 3 years ago.

I still have the same problem, it will not compile because it says:


cannot find symbol - method add(Runner)


 


 

Expert:  LogicPro replied 3 years ago.
Can you provide me error screenshot?

Related Programming Questions