Question: Hi there I need help implementing the following code in java please AutoAutoSalesman must have the following: A collection that holds all of the available
Hi there I need help implementing the following code in java please
AutoAutoSalesman must have the following:
- A collection that holds all of the available cars. This collection is passed as the single argument to the only constructor.
-
Auto recommendations can be based on several criteria. The criteria are: pricePoint, priceRange, ecoFriendly, style.
Any combination of criteria may be selected by the customer, except pricePoint and priceRange, these arguments are always provided together. For example: the customer may select the price (pricePoint and priceRange) and style criteria. The recommendation algorithm would then make recommendations based on only these criteria. Another example: price may be unimportant and the customer only provided ecoFriendly.
- getReco()
- This is the method(s) that will return a collection of Cars meeting the criteria specified in the arguments.
- Cars meeting the provided criteria should be determined as follows:
- pricePoint, priceRange: returned Cars must be within +-(priceRange/2) of the pricePoint. For example: a pricePoint and priceRange of 40000 and 10000 should yield only Cars priced between 35000 and 45000.
- style: returned Cars must have the same style (String) as the one specified.
- ecoFriendly: returned Cars must have a fuelEconomy below 6.0 (litres/100km) if true. If false no preference should be made.
I have attached the class Car, and the testing case


src Teslas.java A1 A 4 AG Add Configuration... Lab 7 - Polymorphism 5.0 Lab Problem 5.1 C Car m getStyle Main.java AutoAuto Salesman. ava X C Car.java Ford Bronco.java x KlaRio.java 1 ! public class Car { 2 3 private final String style; private final double price; 5 private final double fuelEconomy; 6 7 public Car(String style, double price, double fuelEconomy) { 8 this.style = style; 9 this.price = price; 10 this. fuelEconomy = fuelEconomy; 11 } 12 13 E public String getStyle() { return style; 14 15 16 public double getPrice() { return price; 17 } UML Generator UML design tool window ft PlantuML Gradie 18 public double getFuelEconomy { return fuelEconomy; } public void goes() { System.out.println("Vroom"); } 19 20 21 22 of 23 24 25 26 of 27 .: 28 29 30 @Override public String toString() { return this.getClass().toString() + "" + getStyle() + -" + getPrice() + + getFuel Economy(); } 31 32 } E TODO O Problems - Terminal Event Log 13:32 LF UTF-B 4 spaces 1 0 src e Ford Bronco.java KlaRio.java Tesla S.java Add Configuration... Lab 7 - Polymorphism 5.0 Lab Problem 5.1 Main Main.java AutoAuto Salesman.java C Car.java 1 import java.util.ArrayList; 2 import java.util.Arrays; 3 import java.util.List; 01 A1 A 4 5 UML Generator 7 8 9 10 11 12 13 14 15 public class Main { public static void main(String[] args) { // example List
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
