anonymous
  • anonymous
Class
Computer Science
katieb
  • katieb
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
Could anyone explain the basics of a class specifically its parts? I am confused about the the use of :void and (variables, contained, here) not spicifically being passed as the same var name in the class.. any definitive help would be appreciated.
anonymous
  • anonymous
ok, what programming lang do you do? Java? C++?
anonymous
  • anonymous
ok, this explanation is for Java: In the real world, you'll often find many individual objects all of the same kind. There may be thousands of other bicycles in existence, all of the same make and model. Each bicycle was built from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles. A class is the blueprint from which individual objects are created. The following Bicycle class is one possible implementation of a bicycle: class Bicycle { int cadence = 0; int speed = 0; int gear = 1; void changeCadence(int newValue) { cadence = newValue; } void changeGear(int newValue) { gear = newValue; } void speedUp(int increment) { speed = speed + increment; } void applyBrakes(int decrement) { speed = speed - decrement; } void printStates() { System.out.println("cadence:"+cadence+" speed:"+speed+" gear:"+gear); } } The syntax of the Java programming language will look new to you, but the design of this class is based on the previous discussion of bicycle objects. The fields cadence, speed, and gear represent the object's state, and the methods (changeCadence, changeGear, speedUp etc.) define its interaction with the outside world. You may have noticed that the Bicycle class does not contain a main method. That's because it's not a complete application; it's just the blueprint for bicycles that might be used in an application. The responsibility of creating and using new Bicycle objects belongs to some other class in your application.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
Here's a BicycleDemo class that creates two separate Bicycle objects and invokes their methods: class BicycleDemo { public static void main(String[] args) { // Create two different Bicycle objects Bicycle bike1 = new Bicycle(); Bicycle bike2 = new Bicycle(); // Invoke methods on those objects bike1.changeCadence(50); bike1.speedUp(10); bike1.changeGear(2); bike1.printStates(); bike2.changeCadence(50); bike2.speedUp(10); bike2.changeGear(2); bike2.changeCadence(40); bike2.speedUp(10); bike2.changeGear(3); bike2.printStates(); } } The output of this test prints the ending pedal cadence, speed, and gear for the two bicycles: cadence:50 speed:10 gear:2 cadence:40 speed:20 gear:3
anonymous
  • anonymous
Without going into code, a class is a "blueprint" of any "object". Let me explain by taking the example of pre-built houses. These houses have a blueprint - which shows you almost everything you need to know about the house - it's dimensions, different views of the house, etc. All of this, of-course, is still on paper. This is what you'd call a house "class" - there are no real houses yet. When you actually build a house according to this blueprint - or specification, then you have a real house - an "object" of the house "class". So classes specify what concrete objects will look like, what their dimensions are, etc. These are also called properties of the class (like the dimensions of the kitchen, the master bedroom, number of living rooms, etc.). Classes can also have methods - which make concrete objects derived from these classes "do" certain things. Your house may have automatic light control mechanism - whereby the front porch lights come on when it is dark. This is a method of the house.
anonymous
  • anonymous
oktalBlizzard/max_max_mir / THANK YOU! for the tut, bot were clear and concise. Blizz whats the use of void for..in the example class. Does it have a propose, what would the effect be if void were to be removed from the code. This might be a silly question but i need to under stand every detail.

Looking for something else?

Not the answer you are looking for? Search for more explanations.