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
Anna71 [15]
4 years ago
11

Suppose your name was George Gershwin. Write a complete program that would print your last name, followed by a comma, followed b

y your first name. Do not print anything else (that includes blanks).
Computers and Technology
2 answers:
NNADVOKAT [17]4 years ago
6 0

Answer:

I will write the code in C++ and JAVA      

Explanation:

<h2>JAVA CODE</h2>

public class Main

{ public static void main(String[] args) {

       // displays Gershwin,George

     System.out.println("Gershwin,George"); }  }

<h2>C++ Code:</h2>

#include <iostream>

using namespace std;  

int main()

{  cout<<"Gershwin,George"; }    

// displays last name Gershwin followed by , followed by first name George

//displays Gershwin,George as output.

larisa86 [58]4 years ago
5 0
<h2>ANSWER</h2>

=> Code

public class Name{

    public static void main(String [ ] args){

          String firstname = "George";

          String lastname = "Gershwin";

          System.out.println(lastname + "," + firstname);

    }

}

=> Output

Gershwin,George

<h2>EXPLANATION</h2>

The code has been written in Java. The following is the line by line explanation of the code.

// Declare the class header

public class Name{

    // Write the main method for the code.

    public static void main(String [ ] args){

         

          // Declare a string variable called firstname and initialize it to hold the

          // first name which is <em>George</em>.

          String firstname = "George";

          // Declare a string variable called lastname and initialize it to hold the

          // last name which is <em>Gershwin</em>.

          String lastname = "Gershwin";

          // Print out the lastname followed by a comma and then the firstname

          System.out.println(lastname + "," + firstname);

    }      // End of main method

}           // End of class declaration

<h2></h2><h2>NOTE</h2>

The explanation of the code has been written above as comments. Please go through the comments of the code for more understanding.

Nevertheless, a few things are worth noting.

(i) Since it is a complete program, a main class (<em>Name</em>, in this case) has to be defined. The main class has a main method where execution actually begins in Java.

(ii) The first name (George) and last name (Gershwin) are both string values therefore they are to be stored in a String variable. In this case, we have used variable <em>firstname </em>to hold the first name and <em>lastname </em> to hold the last name. Remember that variable names must not contain spaces. So variable names <em>lastname </em>and <em>firstname</em>, though compound words, have been written without a space.

(iii)The System.out.println() method is used for printing to the console in Java and has been used to print out the concatenated combination of last name and first name separated by a comma.

(iv) In Java, strings are concatenated using the + operator. To concatenate two strings lastname and firstname, write the following:

lastname + firstname.

But since they are separated by a comma, it is written as:

lastname + "," + firstname

You might be interested in
What changes might you make to a circuit in order to slow the flow of electrical energy?
Brilliant_brown [7]
it’s gravity that’s what my teacher said
3 0
3 years ago
HELP!! 20 POINTS!!
Svetlanka [38]

Signal processing deals with the analysis and operation of a. mechanical signals b. electrical signals c. biological signals. These can be  b. digital c. analog which vary across a range of values or b. digital with only two possible values.

Explanation:

  • In signal processing, a signal is a function that conveys information about a phenomenon. In electronics and telecommunications, it refers to any time varying voltage, current or electromagnetic wave that carries information.
  • A signal may also be defined as an observable change in a quality such as quantity...
  • A signal can be audio, video, speech, image, sonar and radar-related
  • Signal processing deals with the analysis and operation of mechanical signals, electrical signals and  biological signals.
  • The value of the signal is an electric potential which is voltage is also a signal.
  • The term analog signal usually refers to electrical signals. Analog signals may also be other mediums such as mechanical, pneumatic or hydraulic.
  • An analog signal signifies a continuous signal that keeps changes with a time period. A digital signal signifies a discrete signal that carries binary data and has discrete values. Analog signals are continuous sine waves. Digital signal is square waves

7 0
3 years ago
Three reasons why users attach speakers to their computers.
ZanzabumX [31]

Answer:

Iv'e answered this question 2 times already lol. The purpose of speakers is to produce audio output that can be heard by the listener. Speakers are transducers that convert electromagnetic waves into sound waves. The speakers receive audio input from a device such as a computer or an audio receiver.

Explanation: I hope this helps!

8 0
3 years ago
how to answer the questions on brainly? I've typed my answer in the box but there's no submit button or whatever, and the only t
Zigmanuir [339]

Answer:

push the add your answer button

Explanation:

4 0
3 years ago
Read 2 more answers
What is the impact of Customer Centricity?
skad [1K]
Customer-centric businesses generate greater profits, increased employee engagement, and more satisfied customers. Customer-centric governments and nonprofits create the resiliency, sustainability, and alignment needed to fulfill their mission.
5 0
2 years ago
Other questions:
  • Write a class called Counter that represents a simple tally counter, which might be used to count people as they enter a room. T
    9·1 answer
  • Which of the following would help a photographer keep from dropping a camera? - - Rain hood
    6·2 answers
  • Calculate the average of a set of grades and count
    9·1 answer
  • An action that makes an employee uncomfortable in any way is classified as
    5·1 answer
  • At the ________ level of an organization, functional managers focus on monitoring and controlling operational-level activities a
    14·2 answers
  • What command enables you to initialize quotas on a file system?
    9·1 answer
  • Because all the IEEE WLAN features are isolated in the PHY and ____________ layers, practically any LAN application will run on
    11·1 answer
  • Trading stock or selling stock, selling real estate for profit, and selling other assets that gain value over time.
    13·1 answer
  • Selling emojis that you dont have
    6·1 answer
  • (isc)² certified information systems security professional official study guide 6th editionauthors: stewart, james michael; chap
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!