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
Step: 1
C Program for the Car Class include Class Car private stdstring color double engineCapacity double p...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started