Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HAS TO BE IN C + + 1 - In physics, an object that is in motion is said to have kinetic energy. The following

HAS TO BE IN C++
1- In physics, an object that is in motion is said to have kinetic energy. The following formula
can be used to determine a moving object's kinetic energy:
KE=12xmxv2
The variables in the formula are the following: KE is the kinetic energy, m is the object's mass in
kilograms, and v is the objects velocity in meters per second.
Determine the amount of kinetic energy of a cart with a mass of 30kg moving at a rate of 3ms.
KE=1230kg(3ms)2=135kg9(ms)2=135J
Write a class named KE that has the following member variables:
a. Mass. A float that holds the objects mass (in kg)
b. Velocity. A float that holds the objects velocity in meters per second
In addition, the class should have constructors, destructors, and member functions. Define the
header.
2- Define the constructor that accepts the mass and velocity as arguments.
3- Define the mutator function to store de value in mass member variable.
4- Define the accessor function to get the value stored in velocity member variable.
5- Define the member function that calculates the KE using the mutators and accessors
defined in your class.
6- Demonstrate your class in a program that creates two KE objects, using your constructor
and another asking the user to enter values for mass and velocity.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions