[solved] – Question 9942

Design and implement a set of classes that define the employees
of a hospital: doctor, nurse, administrator, surgeon, receptionist,
janitor, and so on. Include methods in each class that are
named accoring to the services provided by that person and
that print an appropriate message. Create a main method to
instantiate and exercise several of the classes

Expert Answer


[solved] – Question 99420

Write an expression that prints “Special number” if specialNum is 0, -99, or 44.
#include <iostream>
using namespace std;

int main() {
int specialNum;

cin >> specialNum;

if (/* Your solution goes here */) {
cout << “Special number” << endl;
}
else {
cout << “Not special number” << endl;
}

return 0;
}

Expert Answer


[solved] – Question 99421

Write an expression that prints “Eligible” if userAge is between 18 and 25 inclusive.
Ex: 17 prints “Ineligible”, 18 prints “Eligible”.
#include <iostream>
using namespace std;

int main() {
int userAge;

cin >> userAge;

if (/* Your solution goes here */) {
cout << “Eligible” << endl;
}
else {
cout << “Ineligible” << endl;
}

return 0;
}

Expert Answer


[solved] – Question 99422

Write a switch statement that checks nextChoice. If 0, print “Rock”. If 1, print “Paper”. If 2, print “Scissors”. For any other value, print “Unknown”. End with newline.
#include <iostream>
using namespace std;

int main() {
int nextChoice;

cin >> nextChoice;

/* Your solution goes here */

return 0;
}

Expert Answer


[solved] – Question 99423

Write a switch statement that checks origLetter. If ‘a’ or ‘A’, print “Alpha”. If ‘b’ or ‘B’, print “Beta”. For any other character, print “Unknown”. Use fall-through as appropriate. End with newline.
#include <iostream>
using namespace std;

int main() {
char origLetter;

cin >> origLetter;

/* Your solution goes here */

return 0;
}

Expert Answer


[solved] – Question 99424

Assign isTeenager with true if kidAge is 13 to 19 inclusive. Otherwise, assign isTeenager with false.
#include <iostream>
using namespace std;

int main() {
bool isTeenager;
int kidAge;

cin >> kidAge;

/* Your solution goes here */

if (isTeenager) {
cout << “Teen” << endl;
}
else {
cout << “Not teen” << endl;
}

return 0;
}

Expert Answer


[solved] – Question 99425

Write an if-else statement to describe an object. Print “Balloon” if isBalloon is true and isRed is false. Print “Red balloon” if isBalloon and isRed are both true. Print “Not a balloon” otherwise. End with newline.
#include <iostream>
using namespace std;

int main() {
bool isRed;
bool isBalloon;

cin >> isRed;
cin >> isBalloon;

/* Your solution goes here */

return 0;
}

Expert Answer


[solved] – Question 99426

Write an if-else statement that prints “Goodbye” if userString is “Quit”, else prints “Hello”. End with newline.
#include <iostream>
#include <string>
using namespace std;

int main() {
string userString;

cin >> userString;

/* Your solution goes here */

return 0;
}

Expert Answer


[solved] – Question 99427

Print the two strings in alphabetical order. Assume the strings are lowercase. End with newline. Sample output:
capes rabbits
#include <iostream>
#include <string>
using namespace std;

int main() {
string firstString;
string secondString;

cin >> firstString;
cin >> secondString;

/* Your solution goes here */

return 0;
}

Expert Answer


[solved] – Question 99428

Assign the size of userInput to stringSize. Ex: if userInput is “Hello”, output is:
Size of userInput: 5
#include <iostream>
#include <string>
using namespace std;

int main() {
string userInput;
int stringSize;

getline(cin, userInput);

/* Your solution goes here */

cout << “Size of userInput: ” << stringSize << endl;

return 0;
}

Expert Answer