Question: 1. Create a C++ program that has a class. The class is called car and has attributes such as color, engine capacity and price. Create

1. Create a C++ program that has a class. The class is called car and has attributes such as color, engine capacity and price. Create a function called journey that calculates the cost of a journey of 400km assuming the cost of a litre of petrol is Ksh 215 and the car covers 15km per litre of fuel.
2. Create a class called Addition with three integer variables namely addition, subtraction and multiplication. Create a function that receives two integer parameters and calculates their product, sum and difference. The returned values should be assigned to the declared variables respectively (that is addition, subtraction and multiplication)
3. Create a class called a book with attributes title, author and price. Create a function called fines that charges Ksh 10 for everyday the book is not returned to the library. The function should work with two parameters namely number of days and fine per day.

Step by Step Solution

3.37 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

C Program for the Car Class include Class Car private stdstring color double engineCapacity double p... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!