Using an IDE, run the simple C++ program included with this homework in an IDE. Students in previous
C++ courses like Microsoft’s VisualStudio, which is available for Windows, Linux and MacOS. Eclipse is
another. Feel free to use another one, if you like. Take a screen shot of the screen after running the
program in the IDE, and turn it in to Brightspace.
Write a C++ program that declares an Automobile class. The class has variables to hold a vehicle
identification number that can be represented as an integer, miles driven, which can be represented as
a float, and the date of the last maintenance, which should be stored as a string. A class attributes
(variables) should be private.
Automobile should have a getter for each of the above values. The getter for the maintenance date
returns a String. The statement for forming the string for the date is
where “mm”, “dd” and “yy” are the integer variables holding the month, day and year, respectively.
The constructor for automobile takes values for each of the variables, and for the month, day and year,
i.e., it will take an int, float, int, int and int.
A separate file, HW1.cpp, contains the main function. It should call the constructor twice to create two
Automobile objects, and then print out the values of each automobile using
std::cout << <string to be printed> << std::endl;
Take the Automobile class above and store the maintenance date as three integer values, month, date
and year, instead of as a string. The getters and setters for the date should still take three integers and
return a String, respectively.
You should be able to run an unchanged HW1.cpp against the changed Automobile class and get the
same results you got with the original Automobile class.
How to turn in the homework.
Create a directory called <userid>, where <userid> is your Purdue login. Under that directory should be
an A and a B directory. Inside of A directory have the screenshot for A. Inside of the B directory have
two directories, 1 and 2. Inside the 1 directory have the code for part i above and a makefile such that
“make” compiles and runs the code. Inside the 2 directory have the code for part ii above and a makefile
that compiles the code. Turn in the code to Brightspace.
ECE 39595 Homework 1