Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,963 members, 7,817,840 topics. Date: Saturday, 04 May 2024 at 08:54 PM

I Need Help On Java. - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / I Need Help On Java. (1456 Views)

I Need Help On Java / A Question On 'java: How To Program' Deitel. / Must I Learn Everything On Java As An Android Developer? (2) (3) (4)

(1) (Reply) (Go Down)

I Need Help On Java. by Nobody: 4:20pm On Feb 02, 2016
I understand what Java entails, really, OOP - Inheritance, Polymorphism.

But what annoys me is that I can't seem to solve problems with it.

Questions like the following.



i) Write a program to print the individual words and the total count of these words in a given text document without using an array or any class from the java.util package.

ii) Write a method that takes an array of non-negative integers x where x>=0 and x<101 with a duplicate value and returns that duplicate value i.e. when passed [1,2,3,9,3,3,4,1] it returns 3. It returns -1 when no duplicate is found. without using any class from java.util

iii) Write a program that accepts an array of non negative integers and returns the second highest number in that array without using any class from java.util

iv) Write a program that takes a String and returns a sorted (ascending order) array of numbers in that String and an empty array if the string contains no numbers, without using any class from java.util

Read more: http://www.justanswer.com/computer-programming/9d5oj-need-help-solving-java-exercise-relevant-methods.html#ixzz3z1XPHXWV


Anytime I see questions like this and I'm not able to solve it I just hate myself.

Or is it that I need to learn some new concepts, pls help.
Re: I Need Help On Java. by FrankLampard: 4:50pm On Feb 02, 2016
The book, Java how to problem, would help.

Regards
Re: I Need Help On Java. by Nobody: 4:56pm On Feb 02, 2016
FrankLampard:
The book, Java how to problem, would help.

Regards

I have read the book upto Recursion, its a good book though.

I can solve exercises on the book very well.
Re: I Need Help On Java. by FincoApps(m): 9:33pm On Feb 02, 2016
GetAvenue:


I have read the book upto Recursion, its a good book though.

I can solve exercises on the book very well.

I'll advise you work on your logical thinking. Maybe I don't understand the question. Is it that you are trying to solve the above using major OOP concepts or you just can't solve them, probably because it seems impossible ?

If you are looking just to solve them, I can easily assist with the first since that's the simplest then you can challenge yourself to do the rest
Re: I Need Help On Java. by Nobody: 11:19pm On Feb 02, 2016
FincoApps:


I'll advise you work on your logical thinking. Maybe I don't understand the question. Is it that you are trying to solve the above using major OOP concepts or you just can't solve them, probably because it seems impossible ?

If you are looking just to solve them, I can easily assist with the first since that's the simplest then you can challenge yourself to do the rest

Thank you, I figured how to do the first. My problem is that I don't know how I can get my hands on how to use some Java inbuilt methods.
Re: I Need Help On Java. by FincoApps(m): 11:25pm On Feb 02, 2016
GetAvenue:


Thank you, I figured how to do the first. My problem is that I don't know how I can get my hands on how to use some Java inbuilt methods.

Methods like ?

Besides you can check for the documentation of the class that the method belongs to online
Re: I Need Help On Java. by Nobody: 11:33pm On Feb 02, 2016
FincoApps:


Methods like ?

Besides you can check for the documentation of the class that the method belongs to online

What type of books did you read, that gave you the understanding on how to solve those kinds of questions.
Re: I Need Help On Java. by ChinenyeN(m): 5:40am On Feb 03, 2016
[url=docs.oracle.com/javase/7/docs/api/java/util/package-summary.html]This[/url] is the summary of the java.util package. From the instructions, it seems you're supposed to develop a solution to those problems in Java, without using anything from the aforementioned package. I believe the java.util package has to first be imported before it can be used. So, the simple solution to this would be to not import it. That way, you don't run the risk of using the package.

Beyond that, honestly, it's all about critical thinking. I suggest your first step should be to always write out your algorithm by hand. Work through the algorithm with pen and paper. Then research the methods that will allow you to implement your algorithm. If it's taking too long to find the method(s) you want, then write them yourself.

2 Likes

Re: I Need Help On Java. by FincoApps(m): 8:11am On Feb 03, 2016
GetAvenue:


What type of books did you read, that gave you the understanding on how to solve those kinds of questions.

Like Chinenyen said... It's about critical thinking. I really dislike reading except it's a documentation. What I do that enables me solve complex problems is:

I imagine I am the compiler and ask, what instructions do I need to be given in order to perform this task ?
What complex set of instructions do you give your legs in order to walk. (That's just a sample).

In your question, they basically don't want you to use Arrays, Collections, Vectors etc because they make it too easy

(1) (Reply)

Are You Still A Mere Computer Programmer? OMG! / Had Any Very Successful App Being Built By Nigerian Programmers? / What's The Most In-demand Field Of Computer Science/programming?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 32
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.