Answered step by step
Verified Expert Solution
Link Copied!

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 3(80 pts) Create a class
50 points:
Create a class called Carprocon.which helps you decide between two cars
The class should have a class-wide (member attribute) variable called budget and set it to 50,000
The class should have the following instance variables:
price (a double)
model (a string containing make and model)
pros (an Arraylist/or Python list of strings)
cons (an Arraaylist/or Python list of strings)
propoints (an Arraylist/or Python list of integers)
conpoints (an Arraaylist/or Python list of integers)
The class should have the following methods
0. 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 (1-10) ie: 10 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 (1-10) ie: 10 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 arraylist/or 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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions