C++ programming
1) Bug Class Construct a user-defined object class named Bug that models a bug moving along a horizon- tal line. The bug moves either to the right or left. Initially, the bug moves to the right, but it can turn to change its direction. In each move, its position changes by one unit in the current direction. The Bug class will have data members position (type int) for the bug's position on the horizontal line and dir (type int) for the direction the bug is going. A dir value of (positive) 1 in- dicates the bug is moving to the right and a value of -1 signifies that it is moving left. There are five member functions (functions inside the class): a default constructor to initialize position to 0 and dir to +1. a constructor with a single argument to initialize the initial position of the bug to a value set by the user (the initial value of dir should always be +1) void move () to move the bug one space in dir void turn ) to change the direction the bug is moving void display() to display the data members of a Bug object on the terminal screen or write them to a file (note example below). Before writing any code, you and your partner should discuss what the code for this class will look like. Make sure you both have a good idea of what you need to do before you start writing code for this class. Write your bug class code in two files: a interface (or declaration) file named Bug.hpp, and an implementation (or definition) file named Bug.cpp. Remember that the implementation file will need to include the directive #include "Bug.hpp". Also useffndef, fdefine, and ien- dif in your Bug.hpp file. When you have your bug files completed, write a test program to create a Bug object at posi- tion 10, move the bug, turn the bug, and move the bug again. At each position, display the bug's data members on the terminal screen. You main program should be in an application file, i.e., a separate file than your bug files. That application file should have a directive #include "Bug.hpp". Re- member that to compile your program you will need to include both the application file name and the file name Bug.cpp in the compilation command 2 For example, if you named your application file str1.cpp, then you'd use g++ Bug.cpp stri.cpp . to compile your code for this problem. Here is what sample output looks like (user input underlined): position-10, direction-1 position-11, direction-1 position-11. direction--1 position-10, direction--1