Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In this video, I'm going to cover part one of the vending machine application.
The first task was to add the necessary fields to the item class, and if you look back at the requirements,
the fields are private string name.
Private double price.
And private int quantity.
All right, now, remember that if a class is fields, you need to apply the big three steps.
We need to take instructor getters and setters and the constructor is going to be public.
It's going to take as many parameters as there are fields, so three.
And the constructor runs when you create a new object, so we're going to set every field in that object
equal to a parameter value.
All right, simple enough, and now we can use Intellisense to autocomplete, the getters and setters.
Now, Task three told us to add a copy constructor because at some point we're going to need a way to
copy Eitam objects without falling into the trap so we can simply copy this constructor.
And instead of parameters, we're going to be obtaining values from a source object.
And then we're just going to set every field in the current object equal to the field value from a source
object.
All right, and now task force tells us that every class that models an object should have a two string
method.
So we're going to add it to three methods, our class.
And copy over the format.
And will replace the placeholders where we need to.
This name.
Colin.
The stock price.
Put a space here where they put a bracket.
Embed the quantity inside of another Brackett's.
All right, we're done creating the item class.
So inside main.
I'm going to create a new object of the item class.
I'm going to pass in an item named Pepsi worth three ninety nine.
And there is going to be three Pepsis inside the vending machine.
All right, and we can print the object.
Run the code.
And everything works beautifully.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.