Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The cost of an international telephone call is calcualted as follows Connection

ID: 3910885 • Letter: T

Question

The cost of an international telephone call is calcualted as follows Connection fee $1.99 . $2.00 for the first three minutes; and $0 45 for each additional minute. Write a class called TelephoneCost that accepts an Apart from the constructor, write three methods: 2 marks 1 mark] . A boolean method that validates the data. A mutator method that calculates the cost of the call. (4marks) . An accessor that returns the cost for making the call. [1 mark] NOTE: YOU ARE RESPONSIBLE FOR PROVIDEDING THE RELEVANT VARIABLES DO NOT WRITE A TEST CLASS Paragraph

Explanation / Answer

Below is the C++ code I hope that i have provided sufficient comments for your better understanding Note that I have done proper indentation but this code is automatically left alligned on this interface

#include <bits/stdc++.h>
using namespace std;

class TelephoneCost
{
private:
int call_duration;
double cost;
public:
//constructor
TelephoneCost(int n)
{
//set the call duration
call_duration=n;
}
  
void find_cost()
{
//initialize cost to connection fee
cost=1.99;
  
//calculate cost according to given charges
if(call_duration<=3)
{
cost+=2*call_duration;
}
else
{
cost+=2*3 + 0.45*(call_duration-3);
}
}
  
double return_cost()
{
return cost;
}
};

Note that i have not given the main() as you specified that Test class need not be written I will add it if you will require and also i have not added method to validate data as it is given that relevant variables will be provided but i will add it if you will specift it more clearly that what needs to be done

Hope i have answered your question satisfactorily.Leave doubts in comment section if any.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote