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]
2 years 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]2 years 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
Explain step-by-step how to rename a document (without opening it) that is filed in the My Computer/My Documents folder.
Lina20 [59]
You go on folder and double click on the title in your folder hope this is helpful :)
8 0
4 years ago
Three reasons why users attach speakers to their computer
Alla [95]
For media sound
For the game's multimedia sound
For essential system sound
5 0
3 years ago
Effectiveness of thicker,biodegradable plastic shopping bags
juin [17]

The Effectiveness of thicker, biodegradable plastic shopping bags is that they can last for a long time and still be able to carry shopping items  even if they are exposed to natural environment.

<h3>What is the use of biodegradable plastic bags?</h3>

Plastic bags are known to be part of modern technology. They are usually very  thin and strong. They are able to carry a heavy load as a result of shopping.

Conclusively, Note that this type of plastic bags which are said to be biodegradable can last for a long time and still be able to carry shopping items  even if they are exposed to natural environment.

Learn more about bags from

brainly.com/question/728465

4 0
3 years ago
How would you like your social media profiles/personas to be treated in the event of your death? why?
White raven [17]
Depends on the person really. personally i would like it all to be kept for memories but never used anymore
7 0
3 years ago
Read 2 more answers
What is one effect the internet has had on the library
Shkiper50 [21]

Answer:

The internet provides access to an abundance of information from home, making it easier for people to get answers much faster. This efficiency has caused libraries to receive less business and less users, therefore making their service less popular.

7 0
3 years ago
Other questions:
  • When you want to print a page from the World Wide Web, select the print command in the _____.
    8·2 answers
  • The function below takes a single parameter number_list which is a list that can contain integers and floats. Complete the funct
    9·1 answer
  • Which of these is a biotic factor in an aquatic ecosystem?
    10·1 answer
  • On what basis can you categorize the generations of computers?
    11·1 answer
  • Write a short assembly language program in either our 8088 SCO DOSBox or 80386+ MASM Visual Studio 2017 environment that demonst
    11·1 answer
  • You are a security officer of a company. You had an alert from IDS that indicates that one PC on your Intranet is connected to a
    7·1 answer
  • If a triathlon is a sport combining three events, what do you think would be the word for a sport combining five events?
    7·1 answer
  • Write an essay about yourself based on the dimensions of ones personality​
    9·1 answer
  • Who made the game Monopoly???
    10·2 answers
  • A technician is troubleshooting a Windows computer and needs to stop the explorer.exe process.Multiple attempts to open Task Man
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!