1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
maksim [4K]
3 years ago
5

This function receives first_name and last_name, then prints a formatted string of "Name: last_name, first_name" if both names a

re not blank, or "Name: " with just one of the names, if the other one is blank, and nothing if both are blank.
Computers and Technology
1 answer:
pishuonlain [190]3 years ago
3 0

Answer:

Following are the program in the C++ Programming Language.

//set header file

#include <iostream>

//set namespace

using namespace std;

//define class

class format

{

//set access modifier

public:

//set string type variable

 string res;

//define function

 void names(string first_name, string last_name)

 {  

//set if-else if condition to check following conditions

   if(first_name.length()>0 && last_name.length()>0)

   {

     res="Name: "+last_name+", "+first_name;

   }

   else if(first_name.length()>0 and last_name.length()==0)

   {

     res="Name: "+first_name;

   }

   else if(first_name.length()==0 and last_name.length()==0)

   {

     res="";

   }

 }

//define function to print result

 void out(){

   cout<<res<<endl;

 }

};

//define main method

int main() {

//set objects of the class

 format ob,ob1,ob2;

//call functions through 1st object

 ob.names("John","Morris");

 ob.out();

//call functions through 2nd object

 ob1.names("Jhon","");

 ob1.out();

//call functions through 3rd object

 ob2.names("", "");

 ob2.out();

}

<u>Output</u>:

Name: Morris, John

Name: Jhon

Explanation:

<u>Following are the description of the program</u>:

  • Define class "format" and inside the class we define two void data type function.
  1. Define void data type function "names()" and pass two string data type arguments in its parameter "first_name" and "last_name" then, set the if-else conditional statement to check that if the variable 'first_name' is greater than 0 and 'last_name' is also greater than 0 then, the string "Name" and the following variables added to the variable "res". Then, set else if to check that if the variable 'first_name' is greater than 0 and 'last_name' is equal to 0 then, the string "Name" and the following variable "first_name" added to the variable "res".
  2. Define void data type function "out()" to print the results of the variable "res".
  • Finally, we define main method to pass values and call that functions.
You might be interested in
Such a class might store information about the account balance, the name of the account holder, and an account number. What inst
nadya68 [22]

Answer:

an instance variable is a variable that is within a class but it is outside of constructors, methods or blocks.

the instance variables for the class bankAccount can be accountNumber, account holder name and balance.

below are the types and names declared to hold the information.

private string accountHolderName;

private int accountNumber;

private double balance;

note:

accountHolderName is a string data type because names are in alphabets.

accountNumber is an integer since they are in numbers.

balance is a double data type because it is a floating point number.

4 0
3 years ago
18. When you turn off the power to a computer and unplug it at night, it loses the date, and you must reenter it each morning. W
Tema [17]

Answer:

If this is a Mac, it's a common problem and there isn't anything to fix it because it's just like that. I reccomend unplugging the computer and NOT signing off. Because of that, that may be why it is the problem for you. I do not know about Windows Computers, but this is some info that applies with all computers.

Explanation:

7 0
3 years ago
Read 2 more answers
Does anyone know how to permanently delete photos on a dell computer? For my cousin.
strojnjashka [21]

Answer: If your trying to get rid of em. The best way to do that is to put them in the recyling bin and then empty it. Doing that will delete them off your computer so they can't be found.

Explanation: Also keep in mind that whether or not you delete them they'll still be on your hard drive.

6 0
2 years ago
Please answer immediately!!!
diamong [38]

Answer:

Please check the attachment.

Remember:

All N1, N2, N3N, N4, N5, N6, N7 and each of them are certainly like the server. Also note that Router, repeaters, switch and transmitter are not mentioned in the above diagram. Please assume it in between each location.

Explanation:

Please check the attachment. Also, Remember that Server is at the head office, and rest 7 are the 7 branches. The VOIP, video surveillance, Door security system and the computer networks are being shown in the diagram. And each location has a network of computers joined through VLAN, and each of them are given the IP addresses of Class A, Class B and class C of the iPV4(or IPV6), which can be found by the future network administer, operators through the IP address, that is assigned.  

4 0
3 years ago
Calculate the performance of a processor taking into account stalls due to data cache and instruction cache misses. The data cac
zhuklara [117]

Answer:

- Calculate the additional CPI due to the icache stalls.

- Calculate the additional CPI due to the dcache stalls.  

- Calculate the overall CPI for the machine.

The additional CPI due to icache stalls = Hit Rate * Hit Latency + Miss Rate*  

Miss Penalty = 0.9*2 + 0.1*50 = 1.8 + 5 = 6.8  

The additional CPI due to dcache stalls = 0.92*2 + 0.08*124 = 11.76  

The overall CPI = 0.3*11.76 + 0.7*1.0 + 1.0*6.8 = 11.03 7.  

Explanation:

6 0
3 years ago
Other questions:
  • Privileged instructions 1) generate an interrupt so they can execute before non-privileged instructions. 2) are valid only when
    5·1 answer
  • As you're helping a user configure her e-mail over the phone, she remarks that the IP address is different than it was when she
    6·1 answer
  • Liz will use a CD-R compact disk to write to more than once. Carlo will use a CD-RW compact disk to write to more than once. Who
    8·2 answers
  • What does iSCSI stand for?
    5·2 answers
  • An example of an email client is:<br> A.)Yahoo<br> B.)Gmail<br> C.)Outlook<br> D.)All of the Above
    9·1 answer
  • How should you handle possible suicides:
    10·1 answer
  • The Coins class was created to hold all your loose change, kind of like a piggy bank! For this exercise, you are going to simula
    15·1 answer
  • Write a program that asks the p34won to enter their grade, and then prints GRADE is a fun grade. Your program should repeat thes
    7·1 answer
  • The blue section of the following Venn diagram could represent which of the following Boolean statements?
    14·1 answer
  • Select the skill that matches the following definition.​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!