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 car (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

Answers

Answer 1

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:

Car.h

#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

Car.cpp

#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:

https://brainly.com/question/20339175

#SPJ1


Related Questions

Hannah is editing her brother’s birthday video. She has selected the usable shots and copied them onto her computer. What is the next step for Hannah? A. capture the shots B. create a rough cut C. create the final music D. add titles and credits

Answers

Answer:

She needs to create the final music

Answer:

She needs to create the final music

Explanation:

How can a company that collects and uses private customer data ensure it will move forward in a sustainable culture of privacy?
Select an answer:

1- by creating a culture of privacy in every facet of the company's operations
2- by developing an internal data privacy policy that can apply to all current and new products
3- by asking the hard questions, and struggling to get the right answers
4- by making sure the privacy policies provided to customers are up-to-date

Answers

The company that collects and uses private customer data will need to ensure that it will move forward in a sustainable culture of privacy if they act by:

Option 1: creating a culture of privacy in every facet of the company's operations.Option 4- by making sure the privacy policies provided to customers are up-to-date.

What is Data Protection and Privacy?

The terms data protection and data privacy is known to be one that is said to be used a lot and also  interchangeably.

Note that Data privacy is one that tells about who has  the ability or permission to access to data, and data protection is one that gives tools and policies to be able to restrict access to the data.

Hence, The company that collects and uses private customer data will need to ensure that it will move forward in a sustainable culture of privacy if they act by:

Option 1: creating a culture of privacy in every facet of the company's operations.Option 4- by making sure the privacy policies provided to customers are up-to-date.

Learn more about privacy policies from

https://brainly.com/question/13335106

#SPJ1

You are in process of writing a class definition for the class Book. It has three data attributes:
book_title, book_author, and book_publisher. The data attributes should be private.
In Python, write an initializer method that will be part of your class definition. The attributes will
be initialized with parameters that are passed to the method from the main program.
Note: You do not need to write the entire class definition, only the initializer method

Answers

Using the knowledge in computational language in python it is possible to write a code that uses  process of writing a class definition for the class Book.

Writting the code in python:

class Book:

   # a constructor for this class.

   # The constructor should accept an argument for each of the fields.

   def __init__(self, book_title, book_author, book_publisher):

       self.book_title = book_title

       self.book_author = book_author

       self.book_publisher = book_publisher

def main():

   b = Book("title1", "author1", "publisher1")

   print(b.book_title)

   print(b.book_author)

   print(b.book_publisher)

main()

See more about python at brainly.com/question/18502436

#SPJ1

Why are there so few steps to secure
default IIS in Windows Server 2019?

Answers

The few steps to secure default IIS in Windows Server 2019 are:

Select the run window and type “inetmgr” After that  press enter to open IIS web server in the windows system. Go to  Default Document Option.Then select your site. Provide Default Page Name. Set Top in Priority Order.

What is the  Web Server (IIS) role in Windows Server 2019 ?

Web Server (IIS)  which is in the Windows Server 2019  helps to give secure as well as easy-to-manage, modular and extensible platform .

This platform gives a reliably hosting websites and  services, and applications.

It should be noted that Microsoft Internet Information Server (IIS) has been adopted globally and is been used especially in the enterprise, even though it posses less-than-stellar reputation for security.

However, there has been great improvement in the Microsoft's web server solution over the years.

Learn more about Windows Server  on:

https://brainly.com/question/12510017

#SPJ1

pleaseeeee helpppppppp​

Answers

Answer:

int

Explanation:

a (signed) int has a higher rank than a char, therefore the result will be int, and an implicit type promotion will take place.

Mention and discuss specific professional ethics related to augmented reality, artificial intelligence, and the internet of things?

Answers

Specific professional ethics related to augmented reality, artificial intelligence, and the internet of things are:

OpacityBiasEmploymentPrivacySingularityAutonomous systems

What are the professional ethics of AI systems?

Artificial intelligence often has some dilemma that confronts people who are in this field of duty. Some of the daily challenges that they must face are the ones mentioned above. Opacity is a challenge that even the end-users must face. Often, there is the challenge of not knowing how the program came about.

There is a worry about end-users participating in the process of developing some of these systems. People want to be more involved but since machine learning is not easy, many might not know how the results are generated.

Bias is another problem that augmented reality and the other mentioned fields face. Since the output is predictive in nature, there is often the worry that the machine might generate data that impede human freedom.

Learn more about the professional ethics of AI systems here:

https://brainly.com/question/28158916

#SPJ1

How has 5G become more energy efficient?

1. by creating cross channel wavelengths
2. by utilizing beamforming and multiple-input multiple-output (MIMO)
3. by converting to all solar power
4. by utilizing more energy efficient access points

Answers

Option 4. The way that 5G is more efficient is that is is able to  utilize more energy efficient access points.

What is the 5G?

This is the term that is used to refer to the fifth generation mobile network. This is the latest generation of networks and it is known to be a faster way and a more efficient way of connecting to the internet when we compare it to the others that came before it.

This is known to have lower latency when we compare it to the 4G network. It is 100 times said to be faster than the 4G and more efficient for businesses and the people that use them. Hence the The way that 5G is more efficient is that is is able to  utilize more energy efficient access points.

Read more on 5G network here: https://brainly.com/question/24664177

#SPJ1

convert the following decimaal numbers to octal numbers
1. 500
2. 169
3. 53
4.426

Answers

1. 500--->764

2. 169--->251

3. 53--->65

4.426--->652

In what way, if any, is the impact of a given risk affected by the timing of a project?
The impact of a given risk is greater in the middle of a project.
The impact of a given risk is not affected by the timing of a project.
The impact of a given risk is greater in the beginning of a project.
The impact of a given risk is greater toward the end of a project.

Answers

The impact of a given risk affected by the timing of a project is that The impact of a given risk is greater in the beginning of a project.

What is perfect timing?

This is known to be the time when something happens at what we call the exact right or ideal time.

Time is known to be a key or one of the factors that is said to often makes projects what they stand to be.

Note that; projects are said to be often bounded by scope, time, cost, quality and others.

Hence,  The impact of a given risk affected by the timing of a project is that The impact of a given risk is greater in the beginning of a project.

Learn more about timing  from

https://brainly.com/question/2854969

#SPJ1

Answer: The likelihood of risk is greater in the beginning of a project.

Explanation: I got it right on edge

Project 12-2: Bird Counter
Help me make a Python program for birdwatchers that stores a list of birds along with a count of the
number of times each bird has been spotted.


Console
Bird Counter program

Enter 'x' to exit

Enter name of bird: red-tailed hawk
Enter name of bird: killdeer
Enter name of bird: snowy plover
Enter name of bird: western gull
Enter name of bird: killdeer
Enter name of bird: western gull
Enter name of bird: x

Name Count
=============== ===============
Killdeer 2
Red-Tailed Hawk 1
Snowy Plover 1
Western Gull 2


Specifications
 Use a dictionary to store the list of sighted birds and the count of the number of times
each bird was sighted.
 Use the pickle module to read the dictionary from a file when the program starts and
to write the dictionary to a file when the program ends. That way, the data that's
entered by the user isn't lost.

Answers

The program based on the information given is illustrated below.

How to illustrate the program?

It should be noted that a computer program is a set of instructions in a programming language for the computer to execute.

Based on the information, the program is illustrated thus:

Code:

import pickle

#function to read birds data

def readBirdsData():

try:

birdsFile = open("birdsData","rb")

birdWatcher = pickle.load(birdsFile)

birdsFile.close()

birdWatcher ={}

except EOFError:

birdWatcher ={}

return birdWatcher

#function to write the data into file using pickle

def writeBirdsData(birdWatcher):

if birdWatcher == {} :

return

sorted(birdWatcher)

birdsFile = open("birdsData","ab")

pickle.dump(birdWatcher,birdsFile)

birdsFile.close()

#function to display birds data in sorted order

def displayBirdsData(birdWatcher):

print("Name\t\tCount")

print("========\t===========")

for key in sorted(birdWatcher.keys()):

print("{}\t\t{}".format(key,birdWatcher[key]))

#main function

def main():

birdWatcher = readBirdsData()

print("Bird Counter Program")

print ("\nEnter 'x' to exit\n")

name = input("Enter name of bird: ")

while True:

#break the loop if x is entered

if name == 'x':

#if the name exists in dictionary then increase the value

if the name in birdWatcher.keys():

birdWatcher[name] = birdWatcher[name] + 1

else:

#dd it otherwise

birdWatcher[name] = 1

name = input("Enter name of bird: ")

displayBirdsData(birdWatcher)

writeBirdsData(birdWatcher)

#driver code

if __nam__ == '__main__':

main()

Learn more about programs on:

https://brainly.com/question/26642771

#SPJ1

o How basic blocks are identified and how the blocks are used to construct control flow graphs

Answers

Basic blocks are identified  because they are known to be a straight line that is known also as a code sequence that tends to have no branches in regards to its in and out branches and its exception is only to the entry and at the end.

Note that  Basic Block is said to be a composition  of statements that is known to be one that often always executes one after other, and this is often done in a sequence.

How do you create a flow graph from the basic blocks?

Flow graph  is gotten by:

Lets Block B1 be the initial node and also Block B2 will tend to follows B1, so from B2 to B1 there is seen a kind of an edge.

Note that the first task is for a person to partition a sequence of three-address code and this is done into basic blocks.

Hence, Basic blocks are identified  because they are known to be a straight line that is known also as a code sequence that tends to have no branches in regards to its in and out branches and its exception is only to the entry and at the end.

Learn more about basic blocks from

https://brainly.com/question/132319

#SPJ1

• Ethernet network that connects a single client PC to a single server and label the locations of switches and transmission links.

Provide a rationale for each part of your design, explaining the problem, approach, and why you made the choices you made.

Answers

In the network constructed, we need to use 3 switches to  be able to connect a single client PC to the single server. Therefore:

Connect server to switch 1        (225 m)Connect switch 1 to switch 2     (225 m)Connect switch 2 to switch 3    (225 m)Connect switch 3 to client PC   (225 m)

What is the network about?

The maximum distance for ethernet connection is known to be about 100 meters and it is one that is often used in the transmission speeds.

Note that when one has added to the network switches, the distance need to be increased to about 200 meters and thus about 900 meters of distance need to exist between the client PC and the server.

The Ethernet network need to be designed as:

Connect server to switch 1        (225 m)

Connect switch 1 to switch 2     (225 m)

Connect switch 2 to switch 3    (225 m)

Connect switch 3 to client PC   (225 m)

Note that Total distance covered = 225 + 225 + 225 + 225

                                                       = 900 meters

Therefore, In the network constructed, we need to use 3 switches to  be able to connect a single client PC to the single server.

Learn more about Ethernet from

https://brainly.com/question/16947988

#SPJ1

Following Aristotle,man by nature is a political animal,justify the above claim in the light of the Russian invasion of Ukraine

Answers

Following Aristotle, man by nature is a political animal using the claim in the light of the Russian invasion of Ukraine is that:

Aristotle stated that State is natural due to the fact that nature has not made man to be in a self-sufficient state. But Man has a lot of -different type of needs  which they want them to be fulfilled. Russian need and Ukraine need differs and as such, man is fighting to satisfy their needs.

What is the quote about?

In his Politics, Aristotle was  known to be a man who believed man to be a "political animal" due to the fact that he is a social creature that is said to have the power of speech and also one that has moral reasoning:

He sate that man is a lover of war and as such, Aristotle stated that State is natural due to the fact that nature has not made man to be in a self-sufficient state. But Man has a lot of -different type of needs  which they want them to be fulfilled. Russian need and Ukraine need differs and as such, man is fighting to satisfy their needs.

Learn more about Aristotle from

https://brainly.com/question/24994054

#SPJ1

Input a list of employee names and salaries and store them in parallel arrays. End the input with a sentinel value. The salaries should be floating point numbers Salaries should be input in even hundreds. For example, a salary of 36,510 should be input as 36.5 and a salary of 69,030 should be entered as 69.0. Find the average of all the salaries of the employees. Then find the names and salaries of any employee who's salary is within 5,000 of the average. So if the average is 30,000 and an employee earns 33,000, his/her name would be found. Display the following using proper labels. Save your file using the naming format LASTNAME_FIRSTNAME_M08 FE. Turn in your file by clicking on the Start Here button in the upper right corner of your screen. 1.Display the names and salaries of all the employees. 2. Display the average of all the salaries 3. Display all employees that are within 5,000 range of the average.

Answers

Using the knowledge in computational language in JAVA it is possible to write the code being Input a list of employee names and salaries and store them in parallel arrays

Writting the code in JAVA:

BEGIN

DECLARE

employeeNames[100] As String

employeeSalaries[100] as float

name as String

salary, totalSalary as float

averageSalary as float

count as integer

x as integer

rangeMin, rangeMax as float

INITIALIZE

count = 0;

totalSalary =0

DISPLAY “Enter employee name. (Enter * to quit.)”

READ name

//Read Employee data

WHILE name != “*” AND count < 100

employeeNames [count] = name

DISPLAY“Enter salary for “ + name + “.”

READ salary

employeeSalaries[count] = salary

totalSalary = totalSalary + salary

count = count + 1

DISPLAY “Enter employee name. (Enter * to quit.)”

READ name

END WHILE

//Calculate average salary with mix , max range

averageSalary = totalSalary / count

rangeMin = averageSalary - 5

rangeMax = averageSalary + 5

DISPLAY “The following employees have a salary within $5,000 of the mean salary of “ + averageSalary + “.”

For (x = 0; x < count; x++)

IF (employeeSalaries[x] >= rangeMin OR employeeSalaries[x] <= rangeMax )

DISPLAY employeeNames[x] + “\t” + employeeSalaries[x]

END IF

END FOR

END

See more about JAVA at brainly.com/question/12978370

#SPJ1

What relation between two sets S and T must hold so that |S ∪ T| = |S| + |T|

Answers

Suppose S and T are sets. Then the intersection of S and T, denoted S∩T, is the set whose elements are only those that are elements of S and of T.

What is |S ∪ T| = |S| + |T|?

DeMorgan’s Set Theory Laws

In Set Theory, there are analogous relationships called DeMorgan’s Set

Theory Laws. These laws are exactly the analogues of the corresponding logic

laws, where  is replace by the complement, ∧ is replace by ∩, and ∨ is replaced

by ∪. DeMorgan’s Set Theory Laws are stated below:

S ∩ T = S ∪ T and S ∪ T = S ∩ T .

We will prove the latter of these below.

Theorem. Let S and T be sets. Then,

S ∪ T = S ∩ T .

two sets S and T must hold so that |S ∪ T| = |S| + |T|

To learn more about DeMorgan’s Set, refer

https://brainly.com/question/21353067

#SPJ9

Line formatting can be accomplished by using

Answers

Answer:

How can line formatting be accomplished?

To format line spacing:

Select the text you want to format. Selecting text to format.

On the Home tab, click the Line and Paragraph Spacing command. A drop-down menu will appear.

Move the mouse over the various options. A live preview of the line spacing will appear in the document. Select the line spacing you want to use.

The line spacing will change in the document.

Which microsoft tool can be used to review a systems security configuration recommended?

Answers

Answer:The Security Compliance Toolkit (SCT)

Explanation:

It allows security administrators to download, analyze, test, edit, and store Microsoft-recommended security configuration baselines for Windows and other Microsoft products.

Other Questions
URGENT PLS PLS PLS HELP ILL MARK BRAINLIST PLEASE ILL SAY THANKS ILL GIVE FIVE STARS PLEASEWhat are the characteristics of a strongly supported central idea in a nonfiction essay? Find the unit price of 70lbs of honey for $123.99. round your answer to nearest cent if necessary Jabar thinks that aliens have placed the cure for cancer in his brain, and that doctors are holding him in the hospital so they can remove his brain and sell his knowledge. Jabar is experiencing? PLEASE HELP ME ASAP!!!! PLEASE!!! Please help me ill mark you brilliant Z+1 3. Given that Z & W are complex numbers. Prove that |Z + W| - |z w| = 4Re(Z)Re(W) Negligence concerns harm that :_______.a. is unforeseeable. b. arises intentionally. c. arises by accident. d. is always substantial. How many different genes are coordinately regulated by the gal4 transcriptional activator?. in the diagram below all angles are given in degrees()find X with 50,3x,X,X+110 At a restaurant, Isabel and Nancy received a bill for $12.42. If they leave a tip of 15%, how much will each girl pay if they equally divide the total amount? Round where necessary. Dialogue between two friends about the importance of conserving natural resources What is the mean of 13, 7, 8 and 4 In the diagram, the straight line ABC is parallel to EFG and DB is parallel to FC. Given that ABD=38 degrees and DFE=62 degrees. Find angle BDF and CFG A good's market price collapses all relevant information about its uses into one number. a. trueb. false When channel members realize individual benefits can be maximized by working together, making the distribution more efficient, a _______ marketing system has been created. A value curve indicates a lack of effectiveness in a firm's strategic profile when it? What is a religious custom Solve the inequality and enter your solution as an inequality in the box below.Do not use spaces in your answer.2+ x>-8 The diagnosis of hyperglycemic hyperosmolar syndrome is made. what nursing action would be a priority? what is one example of the government limiting rights to protect the rights of others