Hello, I am on my third chapter of java and I am utterly lost. I am supposed to make an app and class that uses get and set as well as constructors. The user of the program is supposed to enter first name, last name,ect This data passes to my heartrates class. I don't understand how or why you go from inputing strings and int to passing that data to the object class. java is really annoying the out of me! Here's the code of my java application that calls a class. How do i take inputed information and send it to the object classes methods? (Why would i even do this?!?!)
Please UseCodeTags. Unformatted code/config/etc. is difficult to read. You can edit your post to include them using the button or re-post the question with proper formatting.
You are doing it the wrong way round. Write the HeartRate class first. Give it fields and a constructor and get and set methods. You will probably find examples in your book, or in the Java™ Tutorials; there are sections about methods, constructors, "passing information" etc.
Are you really making a HeartRate class with a name? I have a heart rate, but have never thought to give it a name. I have a name myself however. So a real-life application would probably have a Person class and that has name, heart rate, age, etc.
And welcome to JavaRanch
ryan tuthill
Greenhorn
Joined: Aug 31, 2009
Posts: 3
posted
0
Thanks for your quick replies. I am a total noob to object programing and have to reinvent the way I think.