Okay so I have a list as a class constructor that is formatted like this
Car(string color, double price, int mileage, int year)
I have created a new method in the class Car that is supposed to take a user input for color and total the price of all the cars that are that color.
I presented the color options to the user by a numbered list. I pass the method the number of the choice they made, and the list itself. Then I used if statements to assign a new string variable the actual color of the car based on the users input.
How would I go about having the method match up the color of the car in the list to the user input, and then add the price if it is the right color?
Thank you for your help! I am at a loss. I have only been coding for a couple months.