Hi, I need to write a program for linux (putty) and please read carefully (I've asked the same question 3 times because the experts who answered my questions wrote their own carmain1.cpp file. Please leave it where it is and only create car.cpp and car.h files.)

Here's carmain1.cpp
/* carmain1.cpp
* Please don't rewrite this file
* I will be using the exact
* same file below when grading
*
*/
#include <iostream>
#include "car.h"
using namespace std;
int main()
{
Car sedan;
// input
string imake;
string imodel;
int iyear;
// output
string omake;
string omodel;
int oyear;
// getting values before setting them.
// This may produce garbage values. We will be
// fixing this in exercise 2.
cout << "Sedan before initialization: " << endl;
omake = sedan.getMake();
cout << "Make: " << omake << endl;
omodel = sedan.getModel();
cout << "Model: " << omodel << endl;
oyear = sedan.getYear();
cout << "Year: " << oyear << endl;
//set the values for sedan
cout << "Setting values for sedan: " << endl;
cout << "Enter make: ";
getline(cin, imake);
sedan.setMake(imake);
cout << "Enter model: ";
getline(cin, imodel);
sedan.setModel(imodel);
cout << "Enter year: ";
cin >> iyear;
cin.ignore(200, '\n');
sedan.setYear(iyear);
// getting the data back out
cout << "printing values for sedan: " << endl;
omake = sedan.getMake();
cout << "Make: " << omake << endl;
omodel = sedan.getModel();
cout << "Model: " << omodel << endl;
oyear = sedan.getYear();
cout << "Year: " << oyear << endl;
return 0;
}
//C++ Code
/*============car.h====================*/
#ifndef _CAR_H_
#define _CAR_H_
#include<iostream>
using namespace std;
class Car
{
private:
//member variables
string make;
string model;
int year;
public:
//default constructor
Car();
//getters
string getMake()const;
string getModel() const;
int getYear()const;
//setters
void setMake(const string mk);
void setModel(const string md);
void setYear(const int yr);
};
#endif
/*================car.cpp======================*/
#include"car.h"
Car::Car()
{
make = "";
model = "";
year = 1312323184;
}
//getters
string Car::getMake()const
{
return make;
}
string Car::getModel() const
{
return model;
}
int Car::getYear()const
{
return year;
}
//setters
void Car::setMake(const string mk)
{
make = mk;
}
void Car::setModel(const string md)
{
model = md;
}
void Car::setYear(const int yr)
{
year = yr;
}
/* carmain1.cpp
* Please don't rewrite this file
* I will be using the exact
* same file below when grading
*
*/
/*===============carmain1.cpp======================*/
#include <iostream>
#include "car.h"
#include<string>
using namespace std;
int main()
{
Car sedan;
// input
string imake;
string imodel;
int iyear;
// output
string omake;
string omodel;
int oyear;
// getting values before setting them.
// This may produce garbage values. We will be
// fixing this in exercise 2.
cout << "Sedan before initialization: " <<
endl;
omake = sedan.getMake();
cout << "Make: " << omake <<
endl;
omodel = sedan.getModel();
cout << "Model: " << omodel <<
endl;
oyear = sedan.getYear();
cout << "Year: " << oyear <<
endl;
//set the values for sedan
cout << "Setting values for sedan: " <<
endl;
cout << "Enter make: ";
getline(cin, imake);
sedan.setMake(imake);
cout << "Enter model: ";
getline(cin, imodel);
sedan.setModel(imodel);
cout << "Enter year: ";
cin >> iyear;
cin.ignore(200, '\n');
sedan.setYear(iyear);
// getting the data back out
cout << "printing values for sedan: " <<
endl;
omake = sedan.getMake();
cout << "Make: " << omake <<
endl;
omodel = sedan.getModel();
cout << "Model: " << omodel <<
endl;
oyear = sedan.getYear();
cout << "Year: " << oyear <<
endl;
return 0;
}
//Output

//If you need any help regarding this solution........ please leave a comment...... thanks
Hi, I need to write a program for linux (putty) and please read carefully (I've asked...
I created a struct for Car and now I need to turn it into a class for Car. Below is the code that I wrote for the structure. For the class, we are suppose to make the data in the class Car private, revise the input so the input function will only read the data from the user, and then it will call an additional function named setUpCar which will put the data into the object. Not sure how to...
c++ program that takes user input from the console and store the data into a linked list. The input made of 4 objects associated to a car: model, make, mileage and year. My program should take the how many inputs the user want to make, followed by the inputs themselves. After the input, my program should print the data inside the linked list. So far, the issue is that my program print some of the input, but not all. Input sample:3HondaSentra89002017ToyotaCamri1098271999NissanSentra87261987current...
Hi I've a problem with this code. When I add more than 1 song to the list, it doesn't show the first one, only shows the latest one, when I called the function displaysong, let's say when you add 2 songs ID 1 then ID 2, it shows only ID 1. Can you fix it. Everything else is fine.. #include <iostream> #include<string> using namespace std; //class Song class Song{ private: int songID; string title; string artist; string album; int year; public:...
I need help debugging this C++ prgram. What Am i doing wrong? //******************************************************** // This program reads two input files whose lines are //ordered by a key data field. This program should merge //these two files, writing an output file that contains //all lines from both files ordered by the same key field. // //********************************************************* #include <iostream> #include<string> #include<fstream> //prototype void mergeTwoFiles (ifstream&,ifstream&, ofstream&); using namespace std; int main() {string inFile1,inFile2,outFile; // input and output files ifstream in1; ifstream in2;...
-can you change the program that I attached to make 3 file
songmain.cpp , song.cpp , and song.h
-I attached my program and the example out put.
-Must use Cstring not string
-Use strcpy
- use strcpy when you use Cstring: instead of this->name=name
.... use strcpy ( this->name, name)
- the readdata, printalltasks, printtasksindaterange,
complitetasks, addtasks must be in the Taskmain.cpp
- I also attached some requirements below as a picture
#include <iostream>
#include <iomanip>
#include <cstring>
#include <fstream>...
The following C++ code include 3 files: Patient.h, Patient.cpp and Main.cpp. The program basically creates and stores patient records. The original code has everything in a single .cpp file. I tried to divide the code in 3 parts (Patient.h, Patient.cpp and Main.cpp), but it is giving me errors. Patient.h #ifndef PATIENT_H #define PATIENT_H #include <string> #include "Patient.cpp" using namespace std; class Patient{ private : string firstname; string lastname; string location; static int cnt; int id; public : Patient(string, string, string);...
Codes: (car.h ; car.cpp ; carDemo.cpp) /* ----------------------- Car ----------------------- - make: string - year : int ----------------------- + Car() + setMake(m: string) : void + getMake() : string + setYear(y: int) : void + getYear() : int ---------------------- */ #ifndef CAR_H #define CAR_H #include <iostream> using namespace std; class Car { private: string make; int year; public: Car(); Car(string); Car(int); Car(string, int); void setMake (string); string getMake() {return make;} void setYear (int); int getYear() {return year;} }; #endif #include...
This is a c++ program. Use the description from Parking Ticket Simulator (listed below) as a basis, where you need to create a Car class and Police Officer class, to create a new simulation. Write a simulation program (refer to the Bank Teller example listed below) that simulates cars entering a parking lot, paying for parking, and leaving the parking lot. The officer will randomly appear to survey the cars in the lot to ensure that no cars are parked...
I need to get this two last parts of my project done by tonight. If you see something wrong with the current code feel free to fix it. Thank you! Project 3 Description In this project, use project 1 and 2 as a starting point and complete the following tasks. Create a C++ project for a daycare. In this project, create a class called child which is defined as follows: private members: string First name string Last name integer Child...
Hey, so i am trying to have my program read a text file using a structure but i also want to be able to modify the results(I kinda have this part but it could be better). I cant seem to get it to read the file(all the values come up as 0 and i'm not sure why because in my other program where it wrote to the txt file the values are on the txt file) i copied and pasted...