Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
Put the class definition in EV.h and the implementation of the constructors and functions in EV.cpp
1. Define a class called "EV", that represents the information of an electric vehicle. The EV is defined with these
attributes: model (string), range(int), unit (string) and year (int). Functions of the EV class must perform
the following operations:
1. A default constructor which sets all the numeric instance variables to zero.
2. A constructor with 4 parameters which sets the 4 instance variables to the corresponding values passed.
3. Implement a getter function for each of the 4 instance variables that will return the value of the instance
variable. For example, the getX() function for the instance variable model must be called
getModel().
4. Implement a setter function for each instance variable that will assign to the instance variable to the
value passed. For example, the setX() function for the instance variable model must be called
setModel().
5. An info function: this function print information of object as following format:
"EV"+ (model]+ "manufactured in" + [year] + "has a range of+[range]+[unit]
6. A Convert function: This function converts the range from kilometers to miles and from miles
to kilometers and returns the result. If the user enters "miles" for the unit and the range in
kilometers, then this function must return the miles. As same if user enters "miles for the unit and
the range in miles, it must return the kilometer value. Using the two equations below:
miles kilometers 1.609
kilometers miles
0.6214
Equation 1
Equation 2
7. A Compare function: This function has one input parameter which is a pointer to an EV object and
prints a message according to following criteria:
If the range of first object (the object that the Compare function is called from) is greater than
second object (input parameter in Compore, the program prints:
info of first object (using info function) new line "drives longer distance on a single charge
than+new lineprint info of second object.
of the range of first object is less than second object, the program prints:
info of first object (using info function) new line "drives shorter distance on a single charge
than+new line print info of second object
of the range of first object is equal to second object, the program prints:
info of first object+ new line "drives the same distance on a single charge as new line.
print info of second object.
expand button
Transcribed Image Text:Put the class definition in EV.h and the implementation of the constructors and functions in EV.cpp 1. Define a class called "EV", that represents the information of an electric vehicle. The EV is defined with these attributes: model (string), range(int), unit (string) and year (int). Functions of the EV class must perform the following operations: 1. A default constructor which sets all the numeric instance variables to zero. 2. A constructor with 4 parameters which sets the 4 instance variables to the corresponding values passed. 3. Implement a getter function for each of the 4 instance variables that will return the value of the instance variable. For example, the getX() function for the instance variable model must be called getModel(). 4. Implement a setter function for each instance variable that will assign to the instance variable to the value passed. For example, the setX() function for the instance variable model must be called setModel(). 5. An info function: this function print information of object as following format: "EV"+ (model]+ "manufactured in" + [year] + "has a range of+[range]+[unit] 6. A Convert function: This function converts the range from kilometers to miles and from miles to kilometers and returns the result. If the user enters "miles" for the unit and the range in kilometers, then this function must return the miles. As same if user enters "miles for the unit and the range in miles, it must return the kilometer value. Using the two equations below: miles kilometers 1.609 kilometers miles 0.6214 Equation 1 Equation 2 7. A Compare function: This function has one input parameter which is a pointer to an EV object and prints a message according to following criteria: If the range of first object (the object that the Compare function is called from) is greater than second object (input parameter in Compore, the program prints: info of first object (using info function) new line "drives longer distance on a single charge than+new lineprint info of second object. of the range of first object is less than second object, the program prints: info of first object (using info function) new line "drives shorter distance on a single charge than+new line print info of second object of the range of first object is equal to second object, the program prints: info of first object+ new line "drives the same distance on a single charge as new line. print info of second object.
Driver Class (EV_driver.cpp)
Create a file EV_driver.cpp with the main function that asks the user to enter the information of two EV
objects and it dynamically creates two objects of type EV. Then, using Convert, Info and Compare
functions, the following results are displayed: (Text in green is user input)
Load first EV
Enter EV Model: Tesla Model 3.
Enter year manufactured: 2019.
Enter range unit (Miles or Kilometers): Kilometers.
You choose Kilometers, so please enter range in kilometers: 488.
Load second EV
Enter EV Model: Model Y.
Enter year manufactured: 2021.
Enter range unit (Miles or Kilometers): Miles.
You choose Miles, so please enter range in miles: 300.
The EV Tesla Model 3 manufactured in 2019 has a range of 400 kilometers
drives shorter distance on a single charge than
The EV Tesla Model Y manufactured in 2021 has a range of 300 miles
Load first EV
Enter EV Model: Tesla Model S.
Enter year manufactured: 2021.
Enter range unit (Miles or Kilometers): Miles.
You choose Miles, so please enter range in miles: 428.
Load second EV
Enter EV Model: Tesla Model 3.
Enter year manufactured: 2021.
Enter range unit (Miles or Kilometers): Kilometers.
You choose Kilometers, so please enter range in kilometers: 576.
The EV Tesla Model S manufactured in 2021 has a range of 420 miles
drives longer distance on a single charge than
The EV Tesla Model 3 manufactured in 2021 has a range of 576 kilometers
Note 1: You are to expect a perfect user who will always enter valid values; that is, do not verify the
validity of user input.
Note 2: Please note that you are supposed to use the pointers at different parts of the lab question. If
you use different methods, even if your program works you do not get any mark
expand button
Transcribed Image Text:Driver Class (EV_driver.cpp) Create a file EV_driver.cpp with the main function that asks the user to enter the information of two EV objects and it dynamically creates two objects of type EV. Then, using Convert, Info and Compare functions, the following results are displayed: (Text in green is user input) Load first EV Enter EV Model: Tesla Model 3. Enter year manufactured: 2019. Enter range unit (Miles or Kilometers): Kilometers. You choose Kilometers, so please enter range in kilometers: 488. Load second EV Enter EV Model: Model Y. Enter year manufactured: 2021. Enter range unit (Miles or Kilometers): Miles. You choose Miles, so please enter range in miles: 300. The EV Tesla Model 3 manufactured in 2019 has a range of 400 kilometers drives shorter distance on a single charge than The EV Tesla Model Y manufactured in 2021 has a range of 300 miles Load first EV Enter EV Model: Tesla Model S. Enter year manufactured: 2021. Enter range unit (Miles or Kilometers): Miles. You choose Miles, so please enter range in miles: 428. Load second EV Enter EV Model: Tesla Model 3. Enter year manufactured: 2021. Enter range unit (Miles or Kilometers): Kilometers. You choose Kilometers, so please enter range in kilometers: 576. The EV Tesla Model S manufactured in 2021 has a range of 420 miles drives longer distance on a single charge than The EV Tesla Model 3 manufactured in 2021 has a range of 576 kilometers Note 1: You are to expect a perfect user who will always enter valid values; that is, do not verify the validity of user input. Note 2: Please note that you are supposed to use the pointers at different parts of the lab question. If you use different methods, even if your program works you do not get any mark
Expert Solution
Check Mark
Still need help?
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Please read all the instructions. The output should be like in the 2nd picture and the green colored words should user inputs. Please show all the codes of EV_driver.cpp, EV.cpp, EV.h files + the 2 outputs. 

Please give as pictures and also as text writing 

Put the class definition in EV.h and the implementation of the constructors and functions in
EV.cpp
1. Define a class called "EV", that represents the information of an electric vehicle. The EV is
defined with these attributes: model (string), range(int), unit (string) and year (int). Func-
tions of the EV class must perform the following operations:
1. A default constructor which sets all the numeric instance variables to zero.
2. A constructor with 4 parameters which sets the 4 instance variables to the corresponding
values passed.
3. Implement a getter function for each of the 4 instance variables that will return the value
of the instance variable. For example, the getX() function for the instance variable
model must be called getModel().
4. Implement a setter function for each instance variable that will assign to the instance
variable to the value passed. For example, the setX() function for the instance variable
model must be called setModel().
5. An info function: this function print information of object as following format:
"EV" + [model]+ "manufactured in" + [year] + "has a range of" + [range] + [unit]
6. A Convert function: This function converts the range from kilometers to miles
and from miles to kilometers and returns the result. If the user enters "miles"
expand button
Transcribed Image Text:Put the class definition in EV.h and the implementation of the constructors and functions in EV.cpp 1. Define a class called "EV", that represents the information of an electric vehicle. The EV is defined with these attributes: model (string), range(int), unit (string) and year (int). Func- tions of the EV class must perform the following operations: 1. A default constructor which sets all the numeric instance variables to zero. 2. A constructor with 4 parameters which sets the 4 instance variables to the corresponding values passed. 3. Implement a getter function for each of the 4 instance variables that will return the value of the instance variable. For example, the getX() function for the instance variable model must be called getModel(). 4. Implement a setter function for each instance variable that will assign to the instance variable to the value passed. For example, the setX() function for the instance variable model must be called setModel(). 5. An info function: this function print information of object as following format: "EV" + [model]+ "manufactured in" + [year] + "has a range of" + [range] + [unit] 6. A Convert function: This function converts the range from kilometers to miles and from miles to kilometers and returns the result. If the user enters "miles"
6. A Convert function: This function converts the range from kilometers to miles
and from miles to kilometers and returns the result. If the user enters "miles"
for the unit and the range in kilometers, then this function must return the miles. As
same if user enters 'miles' for the unit and the range in miles, it must return the kilo-
meter value. Using the two equations below:
miles - kilometers *1.609
kilometers miles* 0.6214
Equation 1
Equation 2
7. A Compare function: This function has one input parameter which is a pointer to an EV
object and prints a message according to following criteria:
o If the range of first object (the object that the Compare function is called from) is
greater than second object (input parameter in Compare, the program prints:
info of first object (using info function) + new line + "drives longer distance on a
single charge than" + new line + print info of second object.
o If the range of first object is less than second object, the program prints:
info of first object (using info function) + new line + "drives shorter distance on a
single charge than" + new line + print info of second object.
o If the range of first object is equal to second object, the program prints:
info of first object + new line + "drives the same distance on a single charge as" +
new line + print info of second object.
Driver Class (EV_driver.cpp)
Create a file EV_driver.cpp with the main function that asks the user to enter the infor-
mation of two EV objects and it dynamically creates two objects of type EV. Then, using
Convert, Info and Compare functions, the following results are displayed: (Text in
green is user input)
Load first EV
Enter EV Model: Tesla Model 3J
Enter year manufactured: 2019J
Enter range unit (Miles or Kilometers) : Kilometers
You choose Kilometers, so please enter range in kilometers: 400J
Load second EV
Enter EV Model: Model YJ
Enter year manufactured: 2021J
Enter range unit (Miles or Kilometers): Miles
You choose Miles, so please enter range in miles: 300.
The EV Tesla Model 3 manufactured in 2019 has a range of 400 kilometers
drives shorter distance on a single charge than
-1- MaL-1v--
L--
Load first EV
Enter EV Model: Tesla Model SJ
Enter year manufactured: 2021J
Enter range unit (Miles or Kilometers): Miles.
You choose Miles, so please enter range in miles: 420
Load second EV
Enter EV Model: Tesla Model 3J
Enter year manufactured: 2021J
Enter range unit (Miles or Kilometers): Kilometers.
You choose Kilometers, so please enter range in kilometers: 576.J
The EV Tesla Model S manufactured in 2021 has a range of 420 miles
drives longer distance on a single charge than
The EV Tesla Model 3 manufactured in 2021 has a range of 576 kilometers
Note 1: You are to expect a perfect user who will always enter valid values; that is, do
not verify the validity of user input.
Note 2: Please note that you are supposed to use the pointers at different parts of the
expand button
Transcribed Image Text:6. A Convert function: This function converts the range from kilometers to miles and from miles to kilometers and returns the result. If the user enters "miles" for the unit and the range in kilometers, then this function must return the miles. As same if user enters 'miles' for the unit and the range in miles, it must return the kilo- meter value. Using the two equations below: miles - kilometers *1.609 kilometers miles* 0.6214 Equation 1 Equation 2 7. A Compare function: This function has one input parameter which is a pointer to an EV object and prints a message according to following criteria: o If the range of first object (the object that the Compare function is called from) is greater than second object (input parameter in Compare, the program prints: info of first object (using info function) + new line + "drives longer distance on a single charge than" + new line + print info of second object. o If the range of first object is less than second object, the program prints: info of first object (using info function) + new line + "drives shorter distance on a single charge than" + new line + print info of second object. o If the range of first object is equal to second object, the program prints: info of first object + new line + "drives the same distance on a single charge as" + new line + print info of second object. Driver Class (EV_driver.cpp) Create a file EV_driver.cpp with the main function that asks the user to enter the infor- mation of two EV objects and it dynamically creates two objects of type EV. Then, using Convert, Info and Compare functions, the following results are displayed: (Text in green is user input) Load first EV Enter EV Model: Tesla Model 3J Enter year manufactured: 2019J Enter range unit (Miles or Kilometers) : Kilometers You choose Kilometers, so please enter range in kilometers: 400J Load second EV Enter EV Model: Model YJ Enter year manufactured: 2021J Enter range unit (Miles or Kilometers): Miles You choose Miles, so please enter range in miles: 300. The EV Tesla Model 3 manufactured in 2019 has a range of 400 kilometers drives shorter distance on a single charge than -1- MaL-1v-- L-- Load first EV Enter EV Model: Tesla Model SJ Enter year manufactured: 2021J Enter range unit (Miles or Kilometers): Miles. You choose Miles, so please enter range in miles: 420 Load second EV Enter EV Model: Tesla Model 3J Enter year manufactured: 2021J Enter range unit (Miles or Kilometers): Kilometers. You choose Kilometers, so please enter range in kilometers: 576.J The EV Tesla Model S manufactured in 2021 has a range of 420 miles drives longer distance on a single charge than The EV Tesla Model 3 manufactured in 2021 has a range of 576 kilometers Note 1: You are to expect a perfect user who will always enter valid values; that is, do not verify the validity of user input. Note 2: Please note that you are supposed to use the pointers at different parts of the
Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Please read all the instructions. The output should be like in the 2nd picture and the green colored words should user inputs. Please show all the codes of EV_driver.cpp, EV.cpp, EV.h files + the 2 outputs. 

Please give as pictures and also as text writing 

Put the class definition in EV.h and the implementation of the constructors and functions in
EV.cpp
1. Define a class called "EV", that represents the information of an electric vehicle. The EV is
defined with these attributes: model (string), range(int), unit (string) and year (int). Func-
tions of the EV class must perform the following operations:
1. A default constructor which sets all the numeric instance variables to zero.
2. A constructor with 4 parameters which sets the 4 instance variables to the corresponding
values passed.
3. Implement a getter function for each of the 4 instance variables that will return the value
of the instance variable. For example, the getX() function for the instance variable
model must be called getModel().
4. Implement a setter function for each instance variable that will assign to the instance
variable to the value passed. For example, the setX() function for the instance variable
model must be called setModel().
5. An info function: this function print information of object as following format:
"EV" + [model]+ "manufactured in" + [year] + "has a range of" + [range] + [unit]
6. A Convert function: This function converts the range from kilometers to miles
and from miles to kilometers and returns the result. If the user enters "miles"
expand button
Transcribed Image Text:Put the class definition in EV.h and the implementation of the constructors and functions in EV.cpp 1. Define a class called "EV", that represents the information of an electric vehicle. The EV is defined with these attributes: model (string), range(int), unit (string) and year (int). Func- tions of the EV class must perform the following operations: 1. A default constructor which sets all the numeric instance variables to zero. 2. A constructor with 4 parameters which sets the 4 instance variables to the corresponding values passed. 3. Implement a getter function for each of the 4 instance variables that will return the value of the instance variable. For example, the getX() function for the instance variable model must be called getModel(). 4. Implement a setter function for each instance variable that will assign to the instance variable to the value passed. For example, the setX() function for the instance variable model must be called setModel(). 5. An info function: this function print information of object as following format: "EV" + [model]+ "manufactured in" + [year] + "has a range of" + [range] + [unit] 6. A Convert function: This function converts the range from kilometers to miles and from miles to kilometers and returns the result. If the user enters "miles"
6. A Convert function: This function converts the range from kilometers to miles
and from miles to kilometers and returns the result. If the user enters "miles"
for the unit and the range in kilometers, then this function must return the miles. As
same if user enters 'miles' for the unit and the range in miles, it must return the kilo-
meter value. Using the two equations below:
miles - kilometers *1.609
kilometers miles* 0.6214
Equation 1
Equation 2
7. A Compare function: This function has one input parameter which is a pointer to an EV
object and prints a message according to following criteria:
o If the range of first object (the object that the Compare function is called from) is
greater than second object (input parameter in Compare, the program prints:
info of first object (using info function) + new line + "drives longer distance on a
single charge than" + new line + print info of second object.
o If the range of first object is less than second object, the program prints:
info of first object (using info function) + new line + "drives shorter distance on a
single charge than" + new line + print info of second object.
o If the range of first object is equal to second object, the program prints:
info of first object + new line + "drives the same distance on a single charge as" +
new line + print info of second object.
Driver Class (EV_driver.cpp)
Create a file EV_driver.cpp with the main function that asks the user to enter the infor-
mation of two EV objects and it dynamically creates two objects of type EV. Then, using
Convert, Info and Compare functions, the following results are displayed: (Text in
green is user input)
Load first EV
Enter EV Model: Tesla Model 3J
Enter year manufactured: 2019J
Enter range unit (Miles or Kilometers) : Kilometers
You choose Kilometers, so please enter range in kilometers: 400J
Load second EV
Enter EV Model: Model YJ
Enter year manufactured: 2021J
Enter range unit (Miles or Kilometers): Miles
You choose Miles, so please enter range in miles: 300.
The EV Tesla Model 3 manufactured in 2019 has a range of 400 kilometers
drives shorter distance on a single charge than
-1- MaL-1v--
L--
Load first EV
Enter EV Model: Tesla Model SJ
Enter year manufactured: 2021J
Enter range unit (Miles or Kilometers): Miles.
You choose Miles, so please enter range in miles: 420
Load second EV
Enter EV Model: Tesla Model 3J
Enter year manufactured: 2021J
Enter range unit (Miles or Kilometers): Kilometers.
You choose Kilometers, so please enter range in kilometers: 576.J
The EV Tesla Model S manufactured in 2021 has a range of 420 miles
drives longer distance on a single charge than
The EV Tesla Model 3 manufactured in 2021 has a range of 576 kilometers
Note 1: You are to expect a perfect user who will always enter valid values; that is, do
not verify the validity of user input.
Note 2: Please note that you are supposed to use the pointers at different parts of the
expand button
Transcribed Image Text:6. A Convert function: This function converts the range from kilometers to miles and from miles to kilometers and returns the result. If the user enters "miles" for the unit and the range in kilometers, then this function must return the miles. As same if user enters 'miles' for the unit and the range in miles, it must return the kilo- meter value. Using the two equations below: miles - kilometers *1.609 kilometers miles* 0.6214 Equation 1 Equation 2 7. A Compare function: This function has one input parameter which is a pointer to an EV object and prints a message according to following criteria: o If the range of first object (the object that the Compare function is called from) is greater than second object (input parameter in Compare, the program prints: info of first object (using info function) + new line + "drives longer distance on a single charge than" + new line + print info of second object. o If the range of first object is less than second object, the program prints: info of first object (using info function) + new line + "drives shorter distance on a single charge than" + new line + print info of second object. o If the range of first object is equal to second object, the program prints: info of first object + new line + "drives the same distance on a single charge as" + new line + print info of second object. Driver Class (EV_driver.cpp) Create a file EV_driver.cpp with the main function that asks the user to enter the infor- mation of two EV objects and it dynamically creates two objects of type EV. Then, using Convert, Info and Compare functions, the following results are displayed: (Text in green is user input) Load first EV Enter EV Model: Tesla Model 3J Enter year manufactured: 2019J Enter range unit (Miles or Kilometers) : Kilometers You choose Kilometers, so please enter range in kilometers: 400J Load second EV Enter EV Model: Model YJ Enter year manufactured: 2021J Enter range unit (Miles or Kilometers): Miles You choose Miles, so please enter range in miles: 300. The EV Tesla Model 3 manufactured in 2019 has a range of 400 kilometers drives shorter distance on a single charge than -1- MaL-1v-- L-- Load first EV Enter EV Model: Tesla Model SJ Enter year manufactured: 2021J Enter range unit (Miles or Kilometers): Miles. You choose Miles, so please enter range in miles: 420 Load second EV Enter EV Model: Tesla Model 3J Enter year manufactured: 2021J Enter range unit (Miles or Kilometers): Kilometers. You choose Kilometers, so please enter range in kilometers: 576.J The EV Tesla Model S manufactured in 2021 has a range of 420 miles drives longer distance on a single charge than The EV Tesla Model 3 manufactured in 2021 has a range of 576 kilometers Note 1: You are to expect a perfect user who will always enter valid values; that is, do not verify the validity of user input. Note 2: Please note that you are supposed to use the pointers at different parts of the
Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education