Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Shane McC
3,005 PointsDoes my Logic make sense? Am I thinking like a programmer in my logic?
Hi Everyone
My goal here is to make sure my approach to Java makes sense. Below I've presented myself with two different scenarios. I've broken the problems down my different classes and methods. Does my logic make sense? Am I attacking my problems below correctly?
Not sue if this makes a difference but I would write the below syntax in Java.
Problem1 Walk 5 miles down the street, wait 5 minutes and walk back up the street
What are nouns? (Person, place thing) Street->this would be the class
What are the properties of the street? Miles
What are verbs/actions? (Action, state of being) Walk, wait-> these could be methods
Problem2 Go to car auction. Buy two vehicles. A dodge truck and a Toyota Camry. Pay for these vehicles at the auction and drive back to the dealership
What are nouns? (Person, place thing)
Car auction->this would be the class, vehicles, truck, Camry, dealership
What are the properties of the car auction? How many vehicles the auction has? What type of vehicles the auction has? How many lanes the auction has?
What are verbs/actions? (Action, state of being) Go to car auction, buy, pay, drive-> these could be methods
1 Answer

Ricardo Hill-Henry
38,443 PointsBoth could use an actual Person class.
The first problem could use a Walk class. Inside the Walk constructor that accepts two parameters for a Person, and street name. Then you could use a method inside Walk for setDistance(), getDistance(), etc..\
public class Person{
public String firstName, lastName;
public Person( String fName, String lName){
.....
}
}
Pubic class Walk{
public int distanceWalked;
Public Walk( Person p, int Distance){
...}
With Car you could make a Car class that contains different type of cars, then include a method inside of your Person ( buyCar( Car carParam) that accepts a Car parameter.
Shane McC
3,005 PointsShane McC
3,005 PointsThanks for the help