In Source file:
Insert comments describing set of statements as indicated.
Check format of output.
====================================================================================================
#include <iostream>
#include "Vehicle.h"
#include "Warranty.h"
#include "Hybrid.h"
using namespace std;
//insert comment describing these set of statements here
void DisplayDivider(string);
string GetInput(string);
void DisplayApplicationInformation();
void TerminateApplication();
int main()
{
DisplayDivider("Start Program");
DisplayApplicationInformation();
//insert comment describing these set of statements
here
DisplayDivider("Vehicle 1");
vehicle vehicle1;
vehicle1.setMake(GetInput("vehicle make"));
vehicle1.setYear(GetInput("vehicle year"));
vehicle1.setMileage(GetInput("vehicle MPG"));
warranty warranty1;
warranty1.setNumYears(atoi(GetInput("number of years
covered under warranty").c_str()));
warranty1.setNumMiles(atoi(GetInput("number of miles
covered under warranty").c_str()));
vehicle1.setWarranty(warranty1);
vehicle1.displayVehicle();
//insert comment describing these set of statements
here
DisplayDivider("Vehicle 2");
warranty warranty2(6, 70000);
vehicle vehicle2("Cadillac", 2017, 26.5,
warranty2);
vehicle2.displayVehicle();
//insert comment describing these set of statements
here
vehicle vehicle3(vehicle2);
vehicle3.~vehicle();
//insert comment describing these set of statements
here
DisplayDivider("Vehicle 3");
warranty warranty3(5, 60000);
hybrid hybrid1(570, "Toyota", 2017, 52,
warranty3);
hybrid1.displayVehicle();
//insert comment describing these set of statements
here
cout << "\nTotal Number of Vehicles: " <<
vehicle::getVehicleNumber() << endl;
TerminateApplication();
return 0;
}
//insert comment describing these set of statements here
void DisplayApplicationInformation()
{
cout << "Welcome to CIS247C Week 7
Lab!\n";
cout << "This program prompts the user for
vehicle information \nand displays the gathered information and
whether the \nvehicle is under warranty. The concepts of
encapsulation, \ncomposition, inheritance, and abstract classes are
\nimplemented throughout this program." << endl;
}
//insert comment describing these set of statements here
void DisplayDivider(string message)
{
cout << "\n**************** " + message + "
****************\n";
}
//insert comment describing these set of statements here
string GetInput(string message)
{
string input;
cout << "Please enter " << message
<< ": ";
getline(cin, input);
return input;
}
//insert comment describing these set of statements here
void TerminateApplication()
{
cout << "\nEnd of CIS247C Week 3.145926535
Lab\n" << endl;
}
/**The c++ program is fully commented as per given
instructions*/
#include <iostream>
#include <string>
#include "Vehicle.h"
#include "Warranty.h"
#include "Hybrid.h"
using namespace std;
/*Function prototypes*/
void DisplayDivider(string);
string GetInput(string);
void DisplayApplicationInformation();
void TerminateApplication();
//Start of main method
int main()
{
DisplayDivider("Start Program");
DisplayApplicationInformation();
/*Calling the function, DisplayDivider with
a string argument */
DisplayDivider("Vehicle 1");
/*Created an instance of vehicle class named
as vehicle1*/
vehicle vehicle1;
/*Set make, year and mileage values by
calling the methods of class vehicle
The argument passed to the methods setMake, setYear
and setMileage is function GetInput
that takes a string arguments*/
vehicle1.setMake(GetInput("vehicle make"));
vehicle1.setYear(GetInput("vehicle year"));
vehicle1.setMileage(GetInput("vehicle MPG"));
/*Create an instance of warranty class
named as warranty1*/
warranty warranty1;
/*Calling setter methods setNumYears,
setNumMiles and setWarranty .
The argument passed to the methods is a function
GetInput that takes string argument
*/
warranty1.setNumYears(atoi(GetInput("number of years
covered under warranty").c_str()));
warranty1.setNumMiles(atoi(GetInput("number of miles
covered under warranty").c_str()));
vehicle1.setWarranty(warranty1);
vehicle1.displayVehicle();
/*Calling function, DisplayDivider with a
string argument, vehicle 2*/
DisplayDivider("Vehicle 2");
/*Create an object of warranty class with with
arguments integer and integer*/
warranty warranty2(6, 70000);
/*Create an object of vehicle class with input
arguments*/
vehicle vehicle2("Cadillac", 2017, 26.5,
warranty2);
/*Calling displayVehicle of vehicle2
class*/
vehicle2.displayVehicle();
/*Create an object of vehicle class with
vehicle2 object ,copy constructor*/
vehicle vehicle3(vehicle2);
/*Calling destructor method of vehicle
class*/
vehicle3.~vehicle();
/*Calling function DisplayDivider with
string argument*/
DisplayDivider("Vehicle 3");
/*Create an object ,warranty3 of warranty
class with with arguments integer and integer*/
warranty warranty3(5, 60000);
/*Create an object hybrid1 of hybrid class
with input arguments*/
hybrid hybrid1(570, "Toyota", 2017, 52,
warranty3);
/*Calling displayVehicle of hybrid1
object*/
hybrid1.displayVehicle();
/*calling getVehicleNumber method with
scope resultion operator(::) with vehicle class*/
cout << "\nTotal Number of Vehicles: " <<
vehicle::getVehicleNumber() << endl;
/*Calling TerminateApplication method
*/
TerminateApplication();
return 0;
}
/*The function ,DisplayApplicationInformation display an
introduction of the program on console output*/
void DisplayApplicationInformation()
{
cout << "Welcome to CIS247C Week 7
Lab!\n";
cout << "This program prompts the user for
vehicle information \nand displays the gathered information and
whether the \nvehicle is under warranty. The concepts of
encapsulation, \ncomposition, inheritance, and abstract classes are
\nimplemented throughout this program." << endl;
}
/*The function, DisplayDivider that string argument and
display the string on console output with
new line before and after the message*/
void DisplayDivider(string message)
{
cout << "\n**************** " + message + "
****************\n";
}
/*The function,GetInput that takes a string argument and
prompts user to enter
string value from the user and return the input string to the
calling mehod.*/
string GetInput(string message)
{
string input;
cout << "Please enter " << message
<< ": ";
getline(cin, input);
return input;
}
/*The mehtod, TerminateApplication that prints the end of
the message string on console output.*/
void TerminateApplication()
{
cout << "\nEnd of CIS247C Week 3.145926535
Lab\n" << endl;
}
In Source file: Insert comments describing set of statements as indicated. Check format of output. ====================================================================================================...
CIS247C Week 3 Project Overview The objective of this week is to enhance last week's Vehicle class by making the following changes: • Create a static variable called numVehicles that holds an int and initialize it to zero. This will allow us to count all the Vehicle objects created in the main class. • Add the copy constructor • Increment numVehicles in all of the constructors • Decrement numVehicle in destructor • Add overloaded versions of setYear and setMpg that...
//Vehicle.h #pragma once #include<iostream> #include"Warranty.h" #include<string> using namespace std; class Vehicle{ protected: string make; int year; double mpg; Warranty warranty; static int numOfVehicles; public: Vehicle(); Vehicle(string s, int y, double m, Warranty warranty); Vehicle(Vehicle& v); ~Vehicle(); string getMake(); int getYear(); double getGasMileage(); void setMake(string s); void setYear(int y); void setYear(string y); void setGasMileage(double m); void setGasMileage(string m); void displayVehicle(); static int getNumVehicles(); Warranty getWarranty(); void setWarranty(Warranty& ); }; //Vehicle.cpp #include "Vehicle.h" #include <string> Vehicle::Vehicle() { make = "unknown"; year =...
Working in C++, Complete the code. // Lab 9 code /* Insert leading comments with your name and the date. Describe the purpose of the code. Also, list each pointer and describe how it is used to enable the selection sort for the linked list structure. */ /* Insert code as described by the comments. */ /* Add comments to each line of code that uses a pointer, describing how it is being used. */ #include <iostream> using namespace std;...
IP requirements: Load an exam Take an exam Show exam results Quit Choice 1: No functionality change. Load the exam based upon the user's prompt for an exam file. Choice 2: The program should display a single question at a time and prompt the user for an answer. Based upon the answer, it should track the score based upon a successful answer. Once a user answers the question, it should also display the correct answer with an appropriate message (e.g.,...
HELLO, PLEASE TAKE TIME TO ANSWER THIS QUESTION. PLESE ENSURE ITS CORRECT AND SHOW THAT THE PROGRAM RUNS. Task 1: Enforcing const-ness throughout Your first job will be to go through all of the code and decide which functions should be declared const. You should find several places throughout the program where this makes sense. We will also make the id data member in the Customer class const , as once a customer has been created their ID will never...
Declare and define TtuStudentNode in TtuStudentNode.h and TtuStudentNode.cpp file. TtuStudentNode has its unique string variable "studentEmail" which contains email address. TtuStudentNode has its unique function member GetEmail() which returns the string variable "studentEmail". TtuStudentNode has its overriding "PrintContactNode()" which has the following definition. void TtuStudentNode::PrintContactNode() { cout << "Name: " << this->contactName << endl; cout << "Phone number: " << this->contactPhoneNum << endl; cout << "Email : " << this->studentEmail << endl; return; } ContactNode.h needs to have the function...
Can I get some help with this question for c++ if you can add some comments too to help understand that will be much appreciated. Code: #include <cstdlib> #include <getopt.h> #include <iostream> #include <string> using namespace std; static long comparisons = 0; static long swaps = 0; void swap(int *a, int *b) { // add code here } void selectionSort(int *first, int *last) { // add code here } void insertionSort(int *first, int *last) { // add code here }...
I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instructions Here is the code Produce correct70 pts O pts Full Marks No Marks results and statisfy requirements view longer Comments 1. Your display amount is not readable 2. I withdraw more than my balance, but I didn't see any error message description Documentations10 pts 0 pts Full Marks No Marks : comment i code and block comment...
Hello, I'm looking to modify my fraction program to include constructors and destructors. Here are all the instructions: Create constructors default two argument three argument copy constructor Create a destructor. The destructor should set whole and numerator to zero and denominator to one. Add cout statements to the constructors and the destructor so you know when it's getting executed. Add system ("pause") to the destructor so you know when it executes. Only positive values allowed If denominator is 0 set...