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
Anna71 [15]
2 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]2 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]2 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
Write code that uses the input string stream inss to read input data from string userinput, and updates variables usermonth, use
mr Goodwill [35]

Answer:

It will be a java code.

Explanation:

import java.util.Scanner;

public class StringInputStream {

    public static void main (String [] args) {

        Scanner inSS = null;

        String userInput = "Jan 12 1992";

        inSS = new Scanner(userInput);`

        String userMonth = "";

        int userDate = 0;

        int userYear = 0;

        /* Your solution goes here  */

        System.out.println("Month: " + userMonth);

        System.out.println("Date: " + userDate);

        System.out.println("Year: " + userYear);

        return;

   }

}

3 0
2 years ago
Read 2 more answers
In the Budget Details sheet, if you wish to autofill with the formula, you must use a ______ reference for the LY Spend Total ce
ahrayia [7]

Answer:

The answer is A.Absolute reference.

Explanation:

Absolute reference is a cell reference whose location remains constant when the formula is copied.

8 0
2 years ago
Adele’s mother owns a Daycare and she wants to learn all about this business, to help her mom and own it one day. Which CTSO sho
Gennadij [26K]

Answer:

She should join the Future Business Leaders of America–Phi Beta Lambda

Explanation:

CTSOs are Career and technical student organizations. These organizations are vocational and extracurricular groups based primarily in high schools, colleges and career technological centres, for students in Career and Technical Education. They are important parts of the high school and college programs.

The Future Business Leaders of America–Phi Beta Lambda prepares students to become community-minded business leaders. It provides opportunities to learn career skills and gain leadership experience.

Therefore Adele should pick this CTSO

7 0
2 years ago
Spark is electrical discharge in air, while air is mix of variety of gases what particles conduct electricity in gas
erastova [34]

Answer:

Mercury, rontgen rays, etc.

Explanation:

There are lots of answers to this question, hope these two help.

6 0
1 year ago
Which statement below correctly differentiates between frames and bits? Frames have more information in them than bits. Frames a
9966 [12]
<span>Frames have more information in them than bits.
</span>
<span>Frames are made up of bits but not vice versa.


A bit (BInary digiT) is the basic unit of digital. It can be 0 (logical false, off) or 1 (not logical false - true, on). Four bits are in a nybble, which can have a value of 0 - 15, eight bits are in a byte which can have a value of 0 - 255. Words vary in size, they consist of multiple bytes and are generally correlated with the system's data bus/processor data width (a 64 bit system has an 8 byte word).
</span>
5 0
2 years ago
Read 2 more answers
Other questions:
  • Which statements describe the advantages of using XML?
    12·2 answers
  • The piston engine uses the ________ to convert the reciprocating motion of the piston into rotary motion.
    13·1 answer
  • Allows you to manually add an entry to the arp cache that resolves the ip address inetaddr to the physical address etheraddr. wh
    13·1 answer
  • Modern operating systems decouple a process address space from the machine’s physical memory. List two advantages of this design
    15·1 answer
  • Dr. Robbins wants to know if there are different opinions regarding the value of public school education between Native American
    11·1 answer
  • Which Internet of Things (IoT) challenge involves the difficulty of developing and implementing protocols that allow devices to
    11·1 answer
  • Produce a list named prime_truths which contains True for prime numbers and False for nonprime numbers in the range [2,100]. We
    11·1 answer
  • array of String objects, words, has been properly declared and initialized. Each element of words contains a String consisting o
    11·1 answer
  • Which statement is true about the purpose of a work in process constraint?
    15·1 answer
  • The hostel in which you plan to spend the night tonight offers very interesting rates, as long as you do not arrive too late. Ho
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!