Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Part 3 ( 8 0 pts ) Create a class 5 0 points: Create a class called Carprocon.which helps you decide between two cars The
Part pts Create a class points: Create a class called Carprocon.which helps you decide between two cars The class should have a classwide member attribute variable called budget and set it to The class should have the following instance variables: price a double model a string containing make and model pros an Arraylistor Python list of strings cons an Arraaylistor Python list of strings propoints an Arraylistor Python list of integers conpoints an Arraaylistor Python list of integers The class should have the following methods A constructor which takes the budget as argument, if you want you can have the constructor also take the make and model a string and the price double so you dont need to call setcar if you dont want to setcar takes as input the make and model a string and the price double setpro takes as input a pro for example Great gas mileage as well as an integer which ie: being high priority. It adds the pro to the pros list and adds the points to the propoints setcon takes as input a pro for example No warranty as well as an integer which ie: being high priority. It adds the con to the cons list and adds the points to the conpoints A printit method that prints out the budget, price, model, pros, cons, propoints, conpoints out nicely. A sum method that takes as argument an arraylistor Python list of integers and returns the sum of them A Compare method takes as input another car instance c and compares it to the data in this instance and decides what car you should buy. It does this by:
Part pts Create a class
points:
Create a class called Carprocon.which helps you decide between two cars
The class should have a classwide member attribute variable called budget and set it to
The class should have the following instance variables:
price a double
model a string containing make and model
pros an Arraylistor Python list of strings
cons an Arraaylistor Python list of strings
propoints an Arraylistor Python list of integers
conpoints an Arraaylistor Python list of integers
The class should have the following methods
A constructor which takes the budget as argument, if you want you can have the constructor also take the make and model a string and the price double so you dont need to call setcar if you dont want to
setcar takes as input the make and model a string and the price double
setpro takes as input a pro for example Great gas mileage as well as an integer which ie: being high priority. It adds the pro to the pros list and adds the points to the propoints
setcon takes as input a pro for example No warranty as well as an integer which ie: being high priority. It adds the con to the cons list and adds the points to the conpoints
A printit method that prints out the budget, price, model, pros, cons, propoints, conpoints out nicely.
A sum method that takes as argument an arraylistor Python list of integers and returns the sum of them
A Compare method takes as input another car instance c and compares it to the data in this instance and decides what car you should buy. It does this by:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started