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?!?!)
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
Joined: Aug 31, 2009
Thanks for your quick replies. I am a total noob to object programing and have to reinvent the way I think.