Explain what does it mean everything for example this \"::\" that is a binary sc
ID: 3547785 • Letter: E
Question
Explain what does it mean everything for example this "::" that is a binary scope resolution operator
#include "stdafx.h"
#include "PatientAccount.h"
#include <iostream>
using namespace std;
const double PatientAccount::getDailyRate() .
{
return m_dailyRate;
}
double PatientAccount::getTotalCharges(double medicationCharges, double surgeryCharges)
{
return ((getDaysSpent() * getDailyRate()) + medicationCharges + surgeryCharges);
}
const int PatientAccount::getDaysSpent()
{
return m_daysSpent;
}
ANNNNNNDD
cout << "Days spent at Hospital: " <<endl;
daysSpent = inputPrompt();
while(inputValidation(daysSpent, MIN_DAYS_SPENT, INT_MAX))
daysSpent = inputPrompt();
PatientAccount Account(daysSpent);
do
{
displayMenu();
menuChoice = inputPrompt();
while(inputValidation(menuChoice, MIN_MENU_CHOICE, MAX_MENU_CHOICE))
menuChoice = inputPrompt();
switch(menuChoice)
{
case 1:
displayGender();
totalGenderCharges += getGender();
break;
case 2:
displayAge();
totalAgeCharges += getAge();
break;
case 3:
displaySurgery();
totalSurgeryCharges += getSurgery();
break;
case 4:
displayMedication();
totalMedicationCharges += getMedication();
break;
case 5:
cout << fixed << showpoint <<setprecision(2)
<< "Total Charges: $" << Account.getTotalCharges(totalMedicationCharges, totalSurgeryCharges) << endl
<< "The patient is aplicable for a subsidy of" << ((Account.getTotalCharges(totalMedicationCharges, totalSurgeryCharges)) * totalGenderCharges) + ((Account.getTotalCharges(totalMedicationCharges, totalSurgeryCharges)) * totalAgeCharges) << endl
<< "Total charges with Goverment Subsidy "<< (Account.getTotalCharges(totalMedicationCharges, totalSurgeryCharges)) - ((Account.getTotalCharges(totalMedicationCharges, totalSurgeryCharges)) * totalGenderCharges) - ((Account.getTotalCharges(totalMedicationCharges, totalSurgeryCharges)) * totalAgeCharges) << endl
<< "Press <ENTER> to EXIT" << endl;
break;
default:
cout << "switch(menuChoice) default error." << endl;
break;
}
}while(menuChoice != 5);
cin.get();
cin.get();
system("pause");
return 0;
}
Explanation / Answer
In computer programming,
1. scope is an enclosing context where values and expressions are associated. The scope resolution operator helps to identify and specify the context to which an identifier refers, particularly by specifying a namespace.the scope resolution operator is written ::.
I am showing the example in c++ where scope resolution is used:-
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.