1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nataliya [291]
1 year ago
6

Given main(), complete the Car class (in files Car.h and Car.cpp) with member functions to set and get the purchase price of a c

ar (SetPurchasePrice(), GetPurchasePrice()), and to output the car's information (PrintInfo()). Ex: If the input is: 2011 18000 2018 where 2011 is the car's model year, 18000 is the purchase price, and 2018 is the current year, the output is: Car's information: Model year: 2011 Purchase price: 18000 Current value: 5770
Computers and Technology
1 answer:
Snezhnost [94]1 year ago
6 0

The C++ program to show and complete the Car class (in files Car.h and Car.cpp) with member functions to set and get the purchase price of a car is:

<h3>Car.h</h3>

#ifndef CARH

#define CARH

class Car{

private:

int modelYear;

 

int purchasePrice;

int currentValue;

public:

void SetModelYear(int userYear);

int GetModelYear() const;

void SetPurchasePrice(int purchasePrice);

int GetPurchasePrice() const;

void CalcCurrentValue(int currentYear);

void PrintInfo();

};

#endif // CARH

<h3>Car.cpp</h3>

#include<iostream>

#include<math.h>

#include "Car.h"

using namespace std;

void Car::SetModelYear(int userYear){

modelYear=userYear;

}

int Car::GetModelYear() const{

return modelYear;

}

void Car::SetPurchasePrice(int userPrice){

purchasePrice = userPrice;

}

int Car::GetPurchasePrice() const{

return purchasePrice;

}

void Car::CalcCurrentValue(int currentYear){

double depreciationRate = 0.15;

int carAge = currentYear- modelYear;

currentValue = (int)round(purchasePrice*pow((1-depreciationRate),carAge));

}

void Car::PrintInfo(){

cout<<"Car's information:\n";

cout<<"\t\tModel Year : "<<GetModelYear();

cout<<"\n\t\tPurchase price: "<<GetPurchasePrice();

cout<<"\n\t\tCurrentValue: "<<currentValue;

}

Read more about C++ programs here:

brainly.com/question/20339175

#SPJ1

You might be interested in
Ryan is looking to buy a new HDTV set. He knows from friends that LCD set screens reflect less light than plasma set screens, bu
lbvjy [14]

Answer: Cognitive

Explanation:

 According to the question, the Ryan shows cognitive attitude towards the HDTV. The cognitive component basically refers to the three main components that are:

  • Thoughts
  • Beliefs
  • Attributes

The cognitive component is one of the type of attitude which basically consist of various types of thoughts, knowledge and the beliefs towards the any type of object. It is one of the belief and opinion of the attitude.  

3 0
2 years ago
Describe one activity that belongs to the organizing phase software engineering.
Lera25 [3.4K]

Answer:

can you be more specific

Explanation:

5 0
3 years ago
Read 2 more answers
What data type or you use to represent true or false values?
vfiekz [6]
The Boolean type is used to represent true or false values
3 0
2 years ago
What is the name of the file in which this
anyanavicka [17]

Answer:

B

Explanation:

i’m an information technology  student and as I remember we used this  name

3 0
3 years ago
How do you change the order of the slides in your presentation within the outline pane? Drag icon up or down Delete slide icon C
Amiraneli [1.4K]

Answer:

Rearrange the order of slides

In the pane on the left, click the thumbnail of the slide that you want to move, and then drag it to the new location. Tip: To select multiple slides, press and hold Ctrl while you click each slide that you want to move, and then drag them as a group to the new location.

Explanation:

7 0
3 years ago
Other questions:
  • ________ is the process the compiler uses to divide your source code into meaningful portions; the message means that the compil
    7·1 answer
  • Which These operating systems use a graphical user interface?
    6·1 answer
  • After fixing the format of her subheadings, she notices that she misspelled the name of one of the famous people
    7·2 answers
  • The physical parts or components of a computer system is called?
    8·2 answers
  • What is cyber ethics​
    10·2 answers
  • Your digital footprint says a lot about you, but not everything is true or accurate. When you're a high school or college studen
    13·1 answer
  • 2. How is accessing the Internet through a home network and public Wi-Fi similar?​
    15·1 answer
  • What will you see on the next line?<br> &gt;&gt;&gt;int(12.8)<br> ___
    15·1 answer
  • Need answer ASAP. No links
    13·1 answer
  • What are the main differences between openldap and microsoft's active directory (ad)? check all that apply
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!