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
Help on What i should say to my IT school lady? Read all three pages
avanturin [10]

Answer:

if you were to rest my would I still be able to have all my stuff that I have done if so I think you could reset it for me

hope this helps

have a good day :)

Explanation:

4 0
3 years ago
A user could find the icon for an attached usb flash drive under what heading in the my computer/computer window?
xxMikexx [17]
  <span>Hi... 

There are three answers ..... 

If the flash drive has a custom icon then there is hidden files on the flash drive. 
An autorun.inf file and a small .ico image file ..... 
( Click organize > Folder and search options >View>Show hidden folders and files. ) 


If the flash drive displays a windows created icon the source directory's are.. 
%SystemRoot%\system32\SHELL32.dll 
%SystemRoot%\system32\imageres.dll 





If the Flash drive has a custom icon stored on the computer the "original source file " could be any ware. 
The image preference retained in AppData.. 

Select flash drive >Right click>Properties>Customize , i take a good ICT course, can u make this the brainliest?</span>
7 0
4 years ago
Consider the following definitions:public boolean someMethod (int[] list, int value){ int counter; boolean flag = false; for (co
alexandr1967 [171]

Answer:

C. Under the condition that value != list[list.length − 1]

Explanation:

In the loop, the value of flag gets overwritten in each iteration, so only the last value of the list matters. Flag is true when value is not equal to the last list element, which is at position list.length-1.

4 0
3 years ago
What specific authentication method has no encryption for user credentials or data, and is not recommended for most applications
GrogVix [38]

Answer:

PAP authentication method

Explanation:

PAP known as Pass word authentication protocol Basically, PAP works like a standard login procedure; the remote system authenticates itself to the using a static user name and password combination, so not recommended for applications.

6 0
3 years ago
In the world of computers, the term ____ refers to the computerâs physical components, such as the monitor, keyboard, motherboar
USPshnik [31]
The missing word there is hardware
6 0
4 years ago
Other questions:
  • Data arranged and stored in a data set
    9·1 answer
  • 30 points!! What should I do if I plug my computer in and it starts making noises and sounds and it starts smelling.
    9·1 answer
  • Having a conversation with someone using a cellular phone is an example of _____ transmission.A. full-duplexB. half-duplexC. ana
    14·1 answer
  • Using truth table, prove that:<br><br> (A + B). C = (A . C)+ (B .C) ?
    7·1 answer
  • Which tool should be used when a fastener, such as a lug nut, is extremely tight
    6·2 answers
  • A certain social media Web site allows users to post messages and to comment on other messages that have been posted. When a use
    7·1 answer
  • Software is the word for:
    15·1 answer
  • Does any body know how to bypass easy anti cheat on crossout
    7·1 answer
  • Select the correct text in the passage.
    11·1 answer
  • Thinking about the career cluster, "Information Technology", which of these careers would typically NOT be included? (Choose thr
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!