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
you are configuring a wireless connection on your home router. Because you live in an apartment complex, the level of security i
REY [17]

The question has the following answers attached

SSID

WEP

WPA

WPA2

Answer is WPA2

WEP is weak and remains highly vulnerable and is hardly used. There are simple and readily available tools that can be used to hack WEP encryption. If you have a choice to make between WPA and WPA2, I would suggest you choose WPA2 over its predecessor WPA. Both encryption methods support secure wireless internet networks from unauthorized access but WPA2 offers more protection. WPA2 uses more advanced and stronger encryption keys and support maximum protection for your connection.

4 0
3 years ago
Voice and fingerprint _______ can significantly improve the security of physical devices and provide stronger authentication for
zysi [14]

Answer:

biometrics

Explanation:

Voice and fingerprint <u>biometrics</u> can significantly improve the security of physical devices and provide stronger authentication for remote access or cloud services.

6 0
3 years ago
Which practice is the safest way to sit at a desk while typing on the computer?
qwelly [4]
Lol just lay back and unleash your gamer side
8 0
4 years ago
Which query will give the following result when it it applied on table 1????!!!!!
Mandarinka [93]

Answer:

B

Explanation:

You need Name , Age and Gender

the second requirement should only match the last row where age is 20 and gender is male.

thrid requirement of the query is that its syntax should be correct.

Option B staisfies all of required so it is the correct option.

6 0
3 years ago
Select the tips you should follow when creating a newsletter.
podryga [215]

When creating a newsletter, it is best to have a guideline and follow tips in making a more creative newsletter that will make readers or audiences hook up. The following tips that an individual should follow when creating a news letter are the following:

-          It is best to be clear and concise when writing

-          Be straight and to the point

-          Be emphatic, by having to know the readers or your audiences.

3 0
4 years ago
Other questions:
  • Which is an example of appropiate online behavior?
    6·1 answer
  • If you wish to edit a data source in a document, you can make modifications when you select the data sources or _____.
    7·2 answers
  • What type of USB connector is always plugged into the computer to connect in external device
    14·1 answer
  • Why we called COBOL as a professional language and not ataught language.(
    13·1 answer
  • Morena has been assigned to develop a program that will analyze data for a real estate firm. She needs to study the patterns in
    11·1 answer
  • Visual Design includes 4 elements: shapes, texture, lines and form.
    6·1 answer
  • List of rules for expert systems​
    6·1 answer
  • What do the Brainly points do? sorry im new here and i dont know how to internet rn .-.
    7·2 answers
  • May someone help me with the this question pls , The governor of a state wants to inform the people about a change in the tax po
    9·1 answer
  • When we connect to a story, it can be mental, emotional, or even physical. <br> True or False?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!