answer.
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]
2 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]2 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
Suppose Dave drops a watermelon off a high bridge and lets it fall until it hits the water. If we neglect air resistance, then t
MaRussiya [10]

Answer:

#include <bits/stdc++.h>

using namespace std;

// driver function

int main()

{

   // variables

  const double g = 9.8;

int sec;

double height;

int    t  = 0;    

double d = 0;    

bool   flag = false;  

// ask to enter time

cout << "Please enter the time of fall(in seconds):";

// read time

cin >> sec;

//ask to enter height

cout << "Please enter the height (in meters):";

//read height

cin >> height;

cout << '\n'

     << "Time(seconds)   Distance(meters)\n"

        "********************************\n";

// calculate height after each seconds

while ( t <= sec) {

cout << setw(23) << left << t

      << setw(24) << left << d << '\n';

// if input height is less

 if ( d > height ) {

  flag = true;

 }

// increament the time

 t += 1;

// find distance

 d = 0.5 * g * (t) * (t);

}

cout << '\n';

// if input height is less then print the Warning

if ( flag ) {

 cout << "Warning - Bad Data: The distance fallen exceeds the height"

         " of the bridge.\n";

}

return 0;

}

Explanation:

Read the time in seconds from user and assign it to "sec" then read height and  assign it to "height".After this find the distance after each second.If the input height is less than the distance at any second, it will print a Warning message. otherwise it will print the distance after each second.

Output:

Please enter the time of fall(in seconds):11                                                                              

Please enter the height (in meters):1111                                                                                  

                                                                                                                         

Time(seconds)   Distance(meters)                                                                                          

********************************                                                                                          

0                      0                                                                                                  

1                      4.9                                                                                                

2                      19.6                                                                                                

3                      44.1                                                                                                

4                      78.4                                                                                                

5                      122.5                                                                                              

6                      176.4                                                                                              

7                      240.1                                                                                              

8                      313.6                                                                                              

9                      396.9                                                                                              

10                     490                                                                                                

11                     592.9  

5 0
2 years ago
What are the possible consequences if you fail to identify system requirements correctly and completely?
AlladinOne [14]
There are a few consequences for failing to identify system requirements. 

1. Strain on time and effort which can cost money for either a company or yourself (depending if you are an employer, employee, etc).

2. Additional costs for hardware. If you decide to upgrade your hardware on a later time. It will cost additional money for repairs and replacements to adjust.

3. It can cause dissatisfaction to a user if you are working as a technician (for example) which can leave a negative mark on your reputation/resume) 
4 0
2 years ago
5. Many vehicles have indicator lights telling you when your
I am Lyosha [343]

Answer:

A.

Explanation:

The rest is nearly impossible to detect or not worth the time.

8 0
2 years ago
Read 2 more answers
Write a method called printRangeOfNumbers that accepts a minimum, maximum numbers as parameters and prints each number from mini
timama [110]

Answer:

The method in python is as follows:

class myClass:

    def printRange(min,max):

         for i in range(min, max+1):

              print("{"+str(i)+"} ", end = '')

           

Explanation:

This line declares the class

class myClass:

This line defines the method

    def printRange(min,max):

This line iterates from min to max

         for i in range(min, max+1):

This line prints the output in its required format

              print("{"+str(i)+"} ", end = '')

5 0
2 years ago
Write an expression that will cause the following code to print "I am a teenager" if the value of userAge is less than 20. Zyboo
VikaD [51]

Answer:

Replace

if userAge > 20

with

userAge > 19

Explanation:

if userAge > 20  checks if age is 21, 22, 23, 24........

The else condition which prints "I am a teenager" checks if age is 20, 19, 18....

Notice that 20 is inclusive of the else condition; this shouldn't be because for userAge to be less than 20, 20 isn't inclusive

To solve this,

Replace if userAge > 20 with userAge > 19

So that, the else

The else condition which prints "I am a teenager" checks if age is 19, 18, 17, 16....

6 0
2 years ago
Other questions:
  • Which type of address is used at the transport layer to identify the receiving application?
    14·1 answer
  • Shaniya has misspelled a scientific name in her biology report. She needs to correct it, but she has no access to a computer. Sh
    13·2 answers
  • Explain the following instructions: ADD 3000, 1050, 1900.
    12·1 answer
  • Which one of the following characteristics or skills of a ScrumMaster are closelyaligned with coaching?Select one:
    5·1 answer
  • You need to design a data storage scheme for Hayseed Heaven library data system. There are several hundred thousand large data r
    8·1 answer
  • Assume that you are testing the Orders database introduced in Watt (2014) - Appendix C. Discuss the problems and possible conseq
    12·1 answer
  • Which argument forces a writer to return to and change the input before resolving a “UnicodeError”?
    10·1 answer
  • What are ways to enter a formula in Excel? Check all that apply. Click on the Function Library group and select a function from
    10·2 answers
  • Write a loop to populate the list user_guesses with a number of guesses. The variable num_guesses is the number of guesses the u
    13·1 answer
  • there is a structure called employee that holds information like employee code, name, date of joining. Write a program to create
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!