6.2. (Part 1) Car Class - Java - ❤️ SOLUTIONS MOVED TO DISCORD ❤️

Опубликовано: 23 Декабрь 2016
на канале: Kakra Detome
39,442
213

❤️ SOLUTIONS ON DISCORD Join my Discord server -   / discord  

Hello everyone, unfortunately Pearson, the publisher, is making it difficult to post the programming challenges because they're calling it a copyright infringement to use their questions on video even though I'm 100% using my solutions. Because of this, I'll be helping you by providing you with the complete solutions (with extensive comments) of the programming challenges (Python, Java etc) for a fee. If you need help, message me on Discord for a breakdown of each of the chapter questions and their cost.

❤️ Need help with code? Join my Discord server -   / discord  

❤️ Other playlists

Programming challenges - Starting out with Python,    • Programming challenges - Starting out with...  

Programming challenges - Starting out with Java,    • Programming challenges - Starting out with...  

Learn Python,    • Learn Python  

Learn Java,    • Learn Java  

Learn PHP,    • Learn PHP  

Learn Unix,    • Learn Unix  

Learn Git,    • Learn Git  

Website of the Day,    • Website of the Day  

Tech how tos -    • Tech How Tos  

❤️ Need help with code? Join my Discord server (Paid programming challenges solutions, programming classes and more)   / discord  

-----------------------------------------------------------------------------------------------------
Starting out with Java: From control structures through objects
Chapter 6
Programming Challenges
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
2. Car class

Write a class named Car that has the following fields:
• yearModel. The yearModel field is an int that holds the car’s year model.
• make. The make field references a String object that holds the make of the car.
• speed. The speed field is an int that holds the car’s current speed.

In addition, the class should have the following constructor and other methods.
• Constructor. The constructor should accept the car’s year model and make as arguments. These values should be assigned
to the object’s yearModel and make fields. The constructor should also assign 0 to the speed field.
• Accessors. Appropriate accessor methods should get the values stored in an object’s yearModel, make, and speed fields.
• accelerate. The accelerate method should add 5 to the speed field each time it is called.
• brake. The brake method should subtract 5 from the speed field each time it is called.

Demonstrate the class in a program that creates a Car object, and then calls the accelerate method five times. After each call to the accelerate method, get the current speed of the car and display it. Then call the brake method five times. After each call to the brake method, get the current speed of the car and display it.

Gaddis, Tony (2015-05-29). Starting Out with Java: From Control Structures through Objects (Page 396 and 397). Pearson Education. Kindle Edition.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bitcoin Address - 1AbnaHDLG3xqmycNHKDKh1gPNst29Rkp6S

Thanks :)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------