4-3 Java: Creating Car Class (Java OOP, Objects, Classes, Setters, Getters)

preview_player
Показать описание
Java Software Solutions Foundations of Program Design
Java Programming Challenge 4-3: Creating Car Class (Java OOP, Objects, Classes, Setters, Getters)

Design and implement a class called Car that contains instance data that
represents the make, model, and year of the car.
Define the Car constructor to initialize these values.
Include getter and setter methods for all instance data, and a toString method
that returns a one-line description of the car.
Create a driver class called CarTest whose main method instantiates and updates
several car objects

Learning to code? Follow my Java tutorials for beginners. I do a lot of Java programming challenges and Java projects as part of my homework - every day!
If you are learning to program, nothing beats solving real programming exercises and coding challenges.
So don't forget to subscribe, as I release new programming videos every day!
Рекомендации по теме
Комментарии
Автор

I was trying to figure out how to automatically create objects for hours today, this video cleared all my doubts, thank

SiddharthAwana
Автор

This is the best explanation i have got .It covers wholesome of topics.Thanks a lot

shamshurr
Автор

Could you try Adding:
Car c1 = new Car ("Ford", "Taurus", 2007);
System.out.println (c1);
c1.setModel ("Explorer");
System.out.println (c1);

while creating another 3 object like c2, c3, and c4, and then print them out.

After that change the model and year for c2 and print the object values,
then change make and model for c3 and print the values, and, finally, change the year of c4
and print the object values?

selmiravdic
Автор

I'm getting an error that says 'cannot find symbol year' in the while loop..

Why am I getting this?

I tripled checked and I wrote this out exactly as you did.

willis
Автор

Thank you so much!, i too was stuck on figuring out how to store an object into an arraylist for hours :'(

robertsterenchak
Автор

i did "this. " instead of underscore and i didnt have to change the instance variable names.

chrisprilloisebola
Автор

How would I go about implementing a loop within a method in the Class?

walsh
Автор

can u help me create a class truck with the following data mebers and methods.
data: Brand, Plate No, Color, No of Wheels, Capacity and Weight Methods.

haroldkentegam
Автор

every time i compile it crashes, i switched from 'while' to 'if' doesnt compile at all any suggestion guys? thank you.

Abelonewolf
Автор

I don't understand how are you printing the 3 variables by just concatenating + car???

Rafiu
Автор

can u help me create a class parking lot with capacity of 7 cars .
A: car arrive, D ; car depart
data: Plate,
A FIU001
A FIU002
A FIU003
D FIU001
D FIU002
A FIU004
A FIU002
D FIU004
A FIU006
A FIU007
A FIU008

dadTatoo
Автор

followed the vid now programme doesn't compile it says "Error does not contain main method" please help

richardsmith
welcome to shbcf.ru