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
Sunny_sXe [5.5K]
4 years ago
7

Write a program that has the following String variables: firstName, middleName, and lastName. Initialize these with your first,

middle, and last names. The program should also have the following char variables: firstInitial, middleInitial, and lastInitial. Store your first, middle, and last initials in these variables. The program should display the contents of these variables on the screen.
Computers and Technology
1 answer:
Licemer1 [7]4 years ago
3 0

Answer:

The programming language is not stated; However, I'll answer your question using C++ programming language.

Comments are used for explanatory purpose

Program starts here

#include<iostream>

#include <string>

using namespace std;

int main()

{

//Declare Variables

string firstName, middleName, lastName;

char firstInitial, middleInitial, lastInitial;

/*Initialize firstName, middleName and lastName (Replace values with your details)*/

firstName = "First Name";

middleName = "Middle Name";

lastName = "Last Name";

 

// Get Initials

firstInitial = firstName.at(0);

middleInitial = middleName.at(0);

lastInitial = lastName.at(0);

 

//Print Results

cout<<"Lastname: "<<lastName<<endl;

cout<<"Firstname: "<<firstName<<endl;

cout<<"Middlename: "<<middleName<<endl;

cout<<"Last Initial: "<<lastInitial<<endl;

cout<<"First Initial: "<<firstInitial<<endl;

cout<<"Middle Initial: "<<middleInitial<<endl;

return 0;

}

You might be interested in
The short-term, 0-24 hours, parking fee, F, at an international airport is given by the following formula:  5, if 0 # h # 3 F5
jek_recluse [69]

The following code will program that prompts the user to enter the num- ber of hours a car is parked at the airport and outputs the parking fee.

<u>Explanation:</u>

Code:

#include<iostream>

using namespace std;

int main()

{

float hours;

cout <<"Enter number of hours a car parked at the airport: "; // prompt the user to enter hours.

cin >> hours ; // strong the hours

if (hours > = 0 && hours < =3 ) // if 0 < = h < = 3

cout << "Parking fee: 5"; //printing parking fee is 5.

else if (hours > 3 && hours < = 9)//if 3 < h < = 9

cout<<"Parking fee: "<<6*int(hours);//converting float value to int the multiplying with 6 then printing fee.

else//if 9 < h < = 24

cout<< "Parking fee: 60";// printing parking fee 60.

return 0;

}

6 0
4 years ago
Three positive impacts of computer technology in our society.​
Contact [7]

Explanation:

1. it has resulted into the manufacturing of vehicles , trains etc

2. 9through computer technology satellites have been invented to boost education through the use of Internet

3. it has improved agriculture by manufacturing machinery such as tractors, ploughs etc

7 0
3 years ago
Read 2 more answers
To recover a deleted document, what would you choose in the info window?
Natasha2012 [34]
"Restore", or in Spanish, "Restaurar".
7 0
4 years ago
The Internet Engineering Task Force (IETF) defines the protocols and standards for how the Internet works. The members of the IE
marta [7]

i believe the answer is b.

8 0
4 years ago
Which type of collaborative tool allows people to communicate using the
frosja888 [35]
D because people can communicate using video conferencing
7 0
3 years ago
Other questions:
  • How can I crack a computer password?
    10·1 answer
  • What command do you type in the search box to access the command line intrface in windows?
    8·1 answer
  • In many programming environments today, one language translates the programmers' code into a different language before the compu
    6·1 answer
  • Which type of chart or graph uses vertical bars to compare data? a Column chart b Line graph c Pie chart d Scatter chart
    14·2 answers
  • A local bank has just one branch. It sets up a peer-to-peer network for all devices on the system. The bank would like to be abl
    12·1 answer
  • What is the most important job of a web server?
    11·2 answers
  • HTML, the markup language of the web, specifies colors using the RGB model. It uses a two-digit hexadecimal (that is, base 16) r
    13·1 answer
  • Write a pseudocode algorithm to ask the user to input the name of a student, the marks he/she received in a test and the worth o
    10·1 answer
  • Which shortcut keys can be used to duplicate a slide?
    15·1 answer
  • Instructions
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!