✅ 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
What's your $code so far?
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.How can I connect the years with the car models?
Sorry, I can't copy it since I work from a school computer.
Should all your car makes be stored as strings or are you supposed to have a
class Car
?I think the first one
Where are you actually setting their value?
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 yetYeah that's fair, I thought they may be tying the name/year together in a class
Can you post the full problem description?
I think sinnflux is correct here, but need to verify
Yes. For example, Opel 2012. And this opel to be not printed out because it's before 2020.
How do I make it?
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.
Can you use List<T> or must be an array?
I'm not sure giving them the full answer is in the spirit of helping them with the assignment 🙂
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
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.How do I do it?
Suddenly 2 days later its now relevant to get help again?
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
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
sorry
i made a new trend