Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Ct+ HOMEWORKI Please write the codel/l PLEASE EXPLAIN WITH COMMENTSITLL GIVE EXTRA SATISFACTION POINT!! In this task a class for electric vehicles is to be

image text in transcribed
Ct+ HOMEWORKI Please write the codel/l PLEASE EXPLAIN WITH COMMENTSITLL GIVE EXTRA SATISFACTION POINT!! In this task a class for electric vehicles is to be implemented. To do this, create a new project task. The header file should contain the class definition and the source text file the associated implementation. Restriction: For both these and the following tasks, all methods of a separate source text file (.cpp) and not in the header file should be implemented unless explicity requested otherwise. Generally neither a main function can exist in the declaration nor in the implementation. (a) Define a category of electric vehicle which determines the maximum speed (in km /h), the capacity of the batteries (in ampere hours-Ah), the charge level of the batteries (in percentage), the average energy consumption (in ampere hours per 100 km) and Mileage of the electric vehicle as private attributes. The maximum speed should be equal to (Typint) and the other fourvalues to beReliable (Type double). b) Implement a constructor for the Electric Vehicle class that uses an "average" car with the following values: 180km/ h top speed 80 Ah battery capacity 50% battery charge status, 11 Ah/100km average fuel consumption, 50,000km mileage c) Implement another constructor for the electric vehicle class that can set private attributes. Make sure that the value range of the data is valid (pay attention to negative values or 0). If a value is incorrect, an error message should alert the user and the corresponding value should be set to the same value as the average car d-)Add functions to the class for setting and querying all attributes. Observe the guarantees regarding the value ranges (analogous to the constructor). Also make sure that the odometer reading is not allowed to be modified. Other than required in the restriction, these methods should be implemented within the header file during the declaration. e) Add to the class a function that loads a vehicle and returns the costs. The price per ampere hour (in e) should be passed to the function as a parameter f) Add a function to the class, which should allow a vehicle to travel a certain distance, Consumption should correspond to the average consumption. The desired distance should be passed to the function as a parameter. At the beginning, check whether the vehicle can cover the distance with the current charge level. If this is not the case, the function returns false and the car does not drive at all; otherwise, trueis returned and the necessary attributes are adjusted

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago