C
C#14mo ago
martito

✅ Carriages with 10 car models with years. If a car is produced in or after 2020 to be printed out.

Help pls ty 🙂
23 Replies
SinFluxx
SinFluxx14mo ago
What's your $code so far?
MODiX
MODiX14mo ago
Posting Code Snippets To post a code snippet type the following: ```cs // code here ``` Notes: - Get an example by typing $codegif in the chat. - Change the language by replacing cs with the language of your choice (for example sql or cpp). - If your code is too long, you can post it to https://paste.mod.gg/ and share the link.
martito
martitoOP14mo ago
No description
martito
martitoOP14mo ago
No description
martito
martitoOP14mo ago
No description
martito
martitoOP14mo ago
How can I connect the years with the car models? Sorry, I can't copy it since I work from a school computer.
SinFluxx
SinFluxx14mo ago
Should all your car makes be stored as strings or are you supposed to have a class Car?
martito
martitoOP14mo ago
I think the first one
SinFluxx
SinFluxx14mo ago
Where are you actually setting their value?
SG97
SG9714mo ago
might want to pay attention to carriages array size I see new string [10] and I also see carriages[10] = Lamborghini; so in essence, how many cars do you have and how many elements does your array have assuming they are using strings is because they haven't learned classes yet
SinFluxx
SinFluxx14mo ago
Yeah that's fair, I thought they may be tying the name/year together in a class
Pobiega
Pobiega14mo ago
Can you post the full problem description? I think sinnflux is correct here, but need to verify
martito
martitoOP14mo ago
Yes. For example, Opel 2012. And this opel to be not printed out because it's before 2020. How do I make it?
Pobiega
Pobiega14mo ago
first, create a class that can hold both car brand and modelyear then, create instances of that class then, loop over your list of cars and check the modelyear before printing.
ekhidna
ekhidna14mo ago
Can you use List<T> or must be an array?
SinFluxx
SinFluxx14mo ago
I'm not sure giving them the full answer is in the spirit of helping them with the assignment 🙂
ekhidna
ekhidna14mo ago
oh sorry than Create a class of Cars as already been said, with 2 properties the Brand and the Year. Instantiate a List of Cars and based on the Year of each car as condition print it. Basicaly @Pobiega already said everything
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
martito
martitoOP14mo ago
How do I do it?
Pobiega
Pobiega14mo ago
Suddenly 2 days later its now relevant to get help again?
martito
martitoOP14mo ago
Yes because I have classes again Sorry 😦 I made a new code This time it doesn't work properly Do I make a new trend? Or do I continue in this one? @Pobiega
Pobiega
Pobiega14mo ago
You can keep this one but asking questions then just vanishing for two days isnt very nice when asking questions here, we expect you to participate in the solution and to update us on whats going on
martito
martitoOP14mo ago
sorry i made a new trend
Want results from more Discord servers?
Add your server