Dear Student,
1. Mutator functions are those functions which is used to modify the value of member variables.
2. Mutator function must have atleast one parameter value to be assigned to member variables.
3. Data type of parameter must match with the data type of data member.
4. Mutator function not required to return a value.
5. General naming convention of mutator function is that it must start with set. e.g. setName(), setAddress() etc
6. Now coming to the question, please see the below Odometer class screenshot for declaring mutator functions and two member variables milesDriven & gallonsOfGasConsumed. Class is very simple self understandable though the comments are written with each of the line.


7. Above code in textual format is mentioned below:-
#include<iostream>
using namespace std;
//Declaration of Class Odometer
class Odometer {
//Declare two private variables milesDriven and
gallonsOfGasConsumed
private :
float milesDriven, gallonsOfGasConsumed;
public:
//Mutator Function to set the miles driven
void setMilesDriven(float milesDriven_parameter){
milesDriven=milesDriven_parameter;
}
//Mutator function to set the gallonsofgasconsumed
void setGallonsOfGasConsumed(float
gallonsOfGasConsumed_parameter){
gallonsOfGasConsumed=gallonsOfGasConsumed_parameter;
}
//Mutator function to Reset miles driven
void resetMilesDriven(){
milesDriven=0;
}
//Mutator function to Reset Gallongs of gas consumed
void resetGallonsOfGasConsumed(){
gallonsOfGasConsumed=0;
}
};
int main(){
}
8. Output of the code is nothing as the question is for declaring and defining a class only but still showing the below screenshot that the code was getting compiled successfully.

9. Still if you feel any questions or query, please feel free to reach me through comments section. I will reply to your query as early as possible.
Thanks!!
Declare and define a C++ class called odometer that will track miles driven and gallons used...
C++, Visual Studio
3. Define a class called Odometer that will be used to track fuel and mileage for an automobile. The class should have instance variables to track the miles driven and the fuel efficiency of the vehicle in miles per gallon. Include a mutator method to reset the odometer to zero miles, a mutator method to set the fuel efficiency, a mutator method that accepts miles driven for a trip and adds it to the odometer's total, and...
*** USING C++ ***
Create a file containing the following: car numbers, miles driven, and gallons of gas used in each car (do not include the readings): Car Number 25 Gallons Used 65 138 36 Miles Driven 1500 3540 1889 2466 2265 68 87 Write a program that reads the data in the file and displays the car number, miles driven, gallons used and the miles per gallon for each car. The output should also contain the total miles drive,...
Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankful of gasoline by recording miles driven and gallons used for each tankful. Develop a C++ program that inputs the miles driven and gallons used for each tankful. The program should calculate and display the miles per gallon obtained for each tankful and print the combined miles per gallon obtained for all tankfuls up to this point.
C++ Lab 9A Inheritance Employee Class Create a project C2010Lab9a; add a source file Lab9a.cpp to the project. Copy and paste the code is listed below: Design a class named Employee. The class should keep the following information in member variables: Employee name Employee number Hire date // Specification file for the Employee class #ifndef EMPLOYEE_H #define EMPLOYEE_H #include <string> using namespace std; class Employee { private: // Declare the Employee name string variable here. // Declare the Employee...
please help me add on this java code to run
public class CarHwMain public static void main(String args 1/ Construct two new cars and one used car for the simulation Cari carl = new Car W"My New Mazda", 24.5, 16.0); Car car2 = new Cart My New Ford" 20.5, 15.0) Cari car) - new Cari ("My Used Caddie", 15.5, 16.5, 5.5, 1/ ADD CODE to completely fill the tanks in the new cars and off the used cars ton //...
C++ Assignment: Create a class called FitnessMember that has only one variable, called name. The FitnessMember class should have a constructor with no parameters, a constructor with a parameter, a mutator function and an accessor function. Also, include a function to display the name. Define a class called Athlete which is derived from FitnessMember. An Athlete record has the Athlete's name (defined in the FitnessMember class), ID number of type String and integer number of training days. Define a class...
Code the following Program in C++ Define a class named Payment that contains a member variable of type float that stores the amount of the payment and appropriate accessor and mutator methods. Also create a member function named paymentDetails that outputs an English sentence that describes the amount of the payment. Next define a class named CashPayment that is derived from Payment. This class should redefine the paymentDetails function to indicate that the payment is in cash. Include appropriate constructor(s)....
7. PersonData and CustomerData classes Design a class named PersonData with the following member variables : lastName firstName address city state zip phone Write the appropriate accessor and mutator functions for these member variables . Next, design a class named CustomerData, which is derived from the PersonData class . The CustomerData class should have the following member variables : customerNumber mailingList The customerNumber variable will be used to hold a unique integer for each customer. The mailingList variable should be a bool....
A liter is 0.264179 gallons. Write a program that will read in the number of liters of gasoline consumed by the user's car and the number of miles per gallon the car delivered. Your program should allow the user to repeat this calculation as often as the user wishes. Define a function to compute the number of miles per gallon. Your program should use a globally defined constant for the number of liters per gallon. After doing this... Modify your...
Java HW Define a class called Counter whose objects count things. An object of this class records a count that is a nonnegative integer. Include methods to set the counter to 0, to increase the count by 1, and to decrease the count by 1. Be sure that no method allows the value of the counter to become negative. Include an accessor method that returns the current count value and a method that outputs the count to the screen. There...