C
C#10mo 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
SinFluxx10mo ago
What's your $code so far?
MODiX
MODiX10mo 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
martito10mo ago
No description
martito
martito10mo ago
No description
martito
martito10mo ago
No description
martito
martito10mo 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
SinFluxx10mo ago
Should all your car makes be stored as strings or are you supposed to have a class Car?
martito
martito10mo ago
I think the first one
SinFluxx
SinFluxx10mo ago
Where are you actually setting their value?
SG97
SG9710mo 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
SinFluxx10mo ago
Yeah that's fair, I thought they may be tying the name/year together in a class
Pobiega
Pobiega10mo ago
Can you post the full problem description? I think sinnflux is correct here, but need to verify
martito
martito10mo 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
Pobiega10mo 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
ekhidna10mo ago
Can you use List<T> or must be an array?
SinFluxx
SinFluxx10mo ago
I'm not sure giving them the full answer is in the spirit of helping them with the assignment 🙂
ekhidna
ekhidna10mo 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
Accord10mo 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
martito10mo ago
How do I do it?
Pobiega
Pobiega10mo ago
Suddenly 2 days later its now relevant to get help again?
martito
martito10mo 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
Pobiega10mo 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
martito10mo ago
sorry i made a new trend
Want results from more Discord servers?
Add your server
More Posts